I am getting "Argument 'XXXController' is not a function, got undefined" error

Posted in General by Adil Burak Kılıç Mon Jan 11 2016 16:47:37 GMT+0000 (Coordinated Universal Time)·2·Viewed 3,282 times

Hello; I want to use oclazyload in my project. I am using ui-router also. In debug mode, I see the message "ocLazyLoad.fileLoaded js/controllers/XXXController.js" but after that, I am getting error. Configuration is like below: .state('shops.menus.entities', { url: "/:menuid/entities", views: { '[email protected]': { templateUrl: "views/wizard.html", controller: "WizardController" } } data: { pageTitle: 'Menu Wizard', roles: ['user'] }, resolve: { // Any property in resolve should return a promise and is executed before the view is loaded loadMyCtrl: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'js/controllers/WizardController.js', ]); }], }, menuTreeObject: function($stateParams, EntityService, ShopService) { return EntityService.getMenuTree($stateParams.menuid, function() { }, function() { }); } }) Thank you.
Jan 11, 2016

Do you have the code of your controller ?

Jan 11, 2016

I found a fix about it. I changed MetronicApp.controller('XXXController', to angular.module('MetronicApp') and it is now working.

Markdown is allowed