Controller not a function, got undefined, while defining controllers globally

后端 未结 14 2043
感动是毒
感动是毒 2020-11-22 00:22

I am writing a sample application using angularjs. i got an error mentioned below on chrome browser.

Error is

Error: [ng:areq] http://errors.

14条回答
  •  情书的邮戳
    2020-11-22 00:54

    I had this problem when I accidentally redeclared myApp:

    var myApp = angular.module('myApp',[...]);
    myApp.controller('Controller1', ...);
    
    var myApp = angular.module('myApp',[...]);
    myApp.controller('Controller2', ...);
    

    After the redeclare, Controller1 stops working and raises the OP error.

提交回复
热议问题