Your problem is that you can’t do this:
angular.module('myApp.controllers', []).controller('BettingController',
['$scope', function($scope) {
$scope.name = "Nick Name";
}]);
angular.module('myApp.controllers', []).controller('ResultsController',
[function() {
The second module definition overrides the first so you end up with a
myApp.controllers module with only ResultsController.
You are probably confusing the two different syntaxes for modules. One
defines a module:
var controllerModule = angular.module('myapp.controllers', []);
The other one gets an existing module:
var controllerModule = angular.module('myapp.controllers');
The difference is that in the second, there is no dependencies array [].
You could fix your code by simply doing:
angular.module('myApp.controllers', []).controller('BettingController',
['$scope', function($scope) {
$scope.name = "Nick Name";
}]);
angular.module('myApp.controllers').controller('ResultsController', [function()
{
}]);
However, I personally prefer not using the chaining method syntax, and
simply doing:
var controllerModule = angular.module('myApp.controllers', []);
controllerModule.controller('BettingController', ['$scope', function($scope) {
$scope.name = "Nick Name";
}]);
controllerModule.controller('ResultsController', [function() {
}]);
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.