Open hani647 opened 7 years ago
Use like the follow, you will not get the error.
loadMyCtrl: ['$ocLazyLoad', '$q', function ($ocLazyLoad, $q) {
var deferred = $q.defer();
try {
$ocLazyLoad.load('app/staticPages/static.controller.js').then(function () {
deferred.resolve();
});
} catch (ex) {
deferred.reject(ex);
}
return deferred.promise;
}]
I've been tring to use ocLazyLoad but this works fine when controller file is cached. I mean for the first visit it gives me controller undefined error but when I visit second time it works fine. Please help