Angularjs: Error: [ng:areq] Argument 'HomeController' is not a function, got undefined

前端 未结 24 1568
抹茶落季
抹茶落季 2020-11-27 12:22

This is my demo using angularjs, for creating a service file, and adding service to a controller.

I have two problems with my demo:

  • One is when I put <
24条回答
  •  萌比男神i
    2020-11-27 13:03

    In my situation this error appeared when I didn't declare function within an array argument.

    The one with error:

    taskAppControllers.controller('MainMenuCtrl', []);
    

    The fixed one:

    taskAppControllers.controller('MainMenuCtrl', [function(){
    
    }]);
    

提交回复
热议问题