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

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

    Really great advise, except that the SAME error CAN occur simply by missing the critical script include on your root page

    example:

    page: index.html

       np-app="saleApp"
    

    Missing

    
    

    When a Route is told what controller and view to serve up:

     .when('/orders/:customerId', {
         controller: 'OrdersController',
         templateUrl: 'views/orders.html'
     })
    

    So essential the undefined controller issue CAN occur in this accidental mistake of not even referencing the controller!

提交回复
热议问题