There can be plenty of reason like
1- There is any bug or error in Controller JS code.
2- check if a controller with given name is registered via $controllerProvider
3- check if evaluating the string on the current scope returns a constructor
4- if $controllerProvider#allowGlobals, check window[constructor] on the global window object (not recommended)
5- Do Make sure to put the appname in ng-app directive on your angular root element (eg:- html) as well. Example:- ng-app="myApp"
6- If everything is fine and you are still getting the issue do remember to make sure you have the right file included in the scripts.
7-You have not defined the same module twice in different places which results in any entities defined previously on the same module to be cleared out, Example angular.module('app',[]).controller(.. and again in another place angular.module('app',[]).service(.. (with both the scripts included of course) can cause the previously registered controller on the module app to be cleared out with the second recreation of module.
8- Re-declaration
var webApp = angular.module('webApp', [...]); webApp.controller('Controller', ...); var webApp = angular.module('webApp', [...]); webApp.controller('Controller1', ...);
1- There is any bug or error in Controller JS code.
2- check if a controller with given name is registered via $controllerProvider
3- check if evaluating the string on the current scope returns a constructor
4- if $controllerProvider#allowGlobals, check window[constructor] on the global window object (not recommended)
5- Do Make sure to put the appname in ng-app directive on your angular root element (eg:- html) as well. Example:- ng-app="myApp"
6- If everything is fine and you are still getting the issue do remember to make sure you have the right file included in the scripts.
7-You have not defined the same module twice in different places which results in any entities defined previously on the same module to be cleared out, Example angular.module('app',[]).controller(.. and again in another place angular.module('app',[]).service(.. (with both the scripts included of course) can cause the previously registered controller on the module app to be cleared out with the second recreation of module.
8- Re-declaration
var webApp = angular.module('webApp', [...]); webApp.controller('Controller', ...); var webApp = angular.module('webApp', [...]); webApp.controller('Controller1', ...);
No comments:
Post a Comment