After creating a dataService.j that contains the following:
angular.module('dataService', [])
.service('gameDataService', function() {
var _gameData = {
loggedIn: "false",
gameJoined:"false",
tableFull: "false",
username: "",
tableInfo: {},
atTable: "",
numJoined: 0,
userNames: [],
numPlayers: _.range(2,7),
numOfRuns: _.range(1,11)
};
this.gameData = _gameData;
return gameData;
});
The controller module is as follows:
var client = angular.module('ui_client_ctrl' ,['ui_IO','dataService']);
client.controller('ClientController', function ($rootScope, $scope,gameDataService) {
$scope.gData = gameDataService.gameData;
console.log(gData);
});
An error message stating 'ReferenceError: gameData is not defined' is being displayed.
Despite referencing examples and ensuring that everything should work, the issue persists. Any suggestions on what might be causing this failure to load?
Your assistance is greatly appreciated,
Z