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

后端 未结 14 1805
感动是毒
感动是毒 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:53

    I got the same error while following an old tutorial with (not old enough) AngularJS 1.4.3. By far the simplest solution is to edit angular.js source from

    function $ControllerProvider() {
      var controllers = {},
          globals = false;
    

    to

    function $ControllerProvider() {
      var controllers = {},
          globals = true;
    

    and just follow the tutorial as-is, and the deprecated global functions just work as controllers.

提交回复
热议问题