I'm using ocLazyLoad library to load on demand modules/files at angular.js. It works awesome and do what it needs to do. However, I'm having one issue when trying to load files from a file that was previously loaded on demand.
the error is this:
Error: jsLoader is not a function
this.$get</filesLoader@https : //localhost/js/angular/includes/lazyload.js:245:1
And the piece of code I'm using (this is the file that was previously loaded on demand. It is executed correctly and actually it tries to load the file, but the above error is what I can see. No ajax is done to try to get the file):
angular.module("App").config(function($stateProvider, $controllerProvider, $ocLazyLoadProvider) {
$ocLazyLoadProvider.config({
debug: true,
events: true
});
$stateProvider.state("controller", {
url: "/:controller/:action",
controller: function($rootScope, $state, $stateParams, $ocLazyLoad) {
if (!$rootScope.controllers)
$rootScope.controllers = {};
if (!$rootScope.controllers[$stateParams.controller]) {
$ocLazyLoad.load([{
files: [
"/js/angular/controller/" + $stateParams.controller + ".js"
]
}]).then(function() {
$rootScope.controllers[$stateParams.controller] = true;
$state.go($stateParams.controller + ( $stateParams.action ? ("." + $stateParams.action) : "" ));
});
}
log($stateParams);
}
})
});
Has anyone had this issue?