mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-16 21:11:38 +00:00
Added frontend pages and trying to model wrestlers on frontend
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
app.controller("tournamentController", function($scope, tournamentsService, $routeParams) {
|
||||
app.controller("tournamentController", function($scope, tournamentsService, $routeParams, Wrestler) {
|
||||
$scope.message = "Test message in scope.";
|
||||
|
||||
// $scope.tournamentData = "test";
|
||||
@@ -9,4 +9,7 @@ app.controller("tournamentController", function($scope, tournamentsService, $rou
|
||||
$scope.tournament = data;
|
||||
});
|
||||
|
||||
$scope.wrestler = Wrestler;
|
||||
|
||||
|
||||
});
|
||||
19
frontend/app/js/models/wrestler.js
Normal file
19
frontend/app/js/models/wrestler.js
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
app.factory('Wrestler', function Wrestler(){
|
||||
var vm = this;
|
||||
|
||||
|
||||
vm.matches = function(matches,wrestler){
|
||||
var givenWrestler = wrestler;
|
||||
|
||||
console.log(givenWrestler.id);
|
||||
return _.filter(matches, function(match){
|
||||
return match.w1 == givenWrestler.id || match.w2 == givenWrestler.id;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
return vm;
|
||||
});
|
||||
@@ -31,8 +31,8 @@ function tournamentsService($http){
|
||||
};
|
||||
|
||||
function successResponse(response){
|
||||
console.log("success log below");
|
||||
console.log(response);
|
||||
// console.log("success log below");
|
||||
// console.log(response);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user