I'm trying to build the User Interface of a game, and AngularJS seems to be perfect for that matter. All my game is inside the global variable ig. ig looks like this :
ig = { money: 100, lives: 3, ... };
I'd like to add ig.money and ig.live to the scope of the controller, so it automatically updates the UI when the variable change within the game.
I tried :
$scope.$watch('ig.money', function() { $scope.money = ig.money; });
but it doesn't work. It says that ig is null. Can someone point me in the right direction? Thank you