Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@idx3d
Created December 10, 2013 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idx3d/7896584 to your computer and use it in GitHub Desktop.
Save idx3d/7896584 to your computer and use it in GitHub Desktop.
function Game(type) {
this.type = type;
this.board = [0,0,0];
}
var app = angular.module('xo', []);
app.factory('game', function () {
return function (type) {
return new Game(type);
}
});
app.controller('GameCtrl', ['game', function ($scope, game) {
$scope.game = game('classic');
$scope.board = game.getBoard();
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment