HomeController not defined angularjs error

I use oclazyload to reduce response time. When loading the homeController, I see that it has been loaded onto the network tab via oclazyload. But the controller does not start when the html page is called. I get an error, for example:

Error: [ng:areq] http://errors.angularjs.org/1.3.12/ng/areq?p0=homeController&p1=not%20aNaNunction%2C%20got%20undefined

my Routes config:

 $routeProvider.when('/',
    {

        templateUrl: 'app/components/home/home.html',
        controller: 'homeController',
          resolve: 
          { // Any property in resolve should return a promise and is executed before the view is loaded
loadMyCtrl: ['$ocLazyLoad', function($ocLazyLoad) {
  // you can lazy load files for an existing module
         return $ocLazyLoad.load('app/components/home/homeController.js');}]}});

How can i solve this?

0
source share

Source: https://habr.com/ru/post/1619332/


All Articles