MCPcopy Index your code
hub / github.com/aws-samples/eb-java-scorekeep / Games

Function Games

public/app/games-controller.js:3–23  ·  view source on GitHub ↗
($scope, $http, $routeParams, SessionService, UserService, GameService, api)

Source from the content-addressed store, hash-verified

1var module = angular.module('scorekeep');
2module.controller('GamesController', Games);
3function Games($scope, $http, $routeParams, SessionService, UserService, GameService, api) {
4 $scope.games = GameService.query({ sessionid: $routeParams.sessionid });
5 $scope.session = SessionService.get({ id: $routeParams.sessionid });
6 $scope.gamename = "my game";
7
8 $scope.createGame = function () {
9 var game = new GameService();
10 game.$save( { sessionid: $routeParams.sessionid }, function() {
11 game.session = $routeParams.sessionid;
12 game.name = $scope.gamename;
13 game.$update({ sessionid: $routeParams.sessionid, id: game.id }, function() {
14 $scope.games.push(angular.copy(game));
15 })
16 }
17 )};
18 $scope.deleteGame = function (index) {
19 var gameId = $scope.games[index].id;
20 $http.delete( api + 'game/' + $routeParams.sessionid + "/" + gameId);
21 $scope.games.splice(index, 1);
22 };
23}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected