ocombe / ocLazyLoad

Lazy load modules & components in AngularJS
https://oclazyload.readme.io
MIT License
2.63k stars 510 forks source link

Controller not getting register and called #414

Open pinal-r opened 6 years ago

pinal-r commented 6 years ago

I have added below config for controller

$ocLazyLoadProvider.config({ 'debug': true, // For debugging 'true/false' 'events': true, // For Event 'true/false' 'modules': [{ // Set modules initially name : 'usersCtrl', // State1 module files: ['protected/controllers/usersCtrl.js'] }] });

on route

$stateProvider.state('users', { url: "/users", views : { "" : { templateUrl:"protected/views/users.html" } }, resolve: { loadMyCtrl: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load('usersCtrl'); // Resolve promise and load before view }] } });

usersCtrl.js gets loaded i can see that in network but not executing. i kept console alert but nothing worker.

app.controller('usersCtrl', function ($scope, $rootScope, $state, $timeout, $http, $mdDialog,$stateParams,$mdToast,$sce,formatDate)

console.log("controller call");

angular.element(document).ready(function () { console.log("ready"); }); });