I like to know how I could handle resource loading errors in ocLazyLoading. I try to load some resources in the resolve part inside my $stateProvider
. There is one file ctrl.js
which is available to load. Another file called iam-not-there.js
is trying to load but this resource doesnt exist.
Now I would like to handle this "loading" error (proceed with the resolve part even if there is an error in resource loading, handle/catch a resource loading error, and so on...). It just work fine if all my resources are available to load. Once one resource is not able to be loaded the application does not proceed with the resolve state. Here is a plnkr example to reproduce this problem.
var myApp = angular.module("myApp", ['ui.router', 'oc.lazyLoad']);
myApp.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('login', {
url: '/',
templateUrl: 'template.html',
controller: 'LoginController',
resolve: {
deps: ['$ocLazyLoad', function($ocLazyLoad) {
return $ocLazyLoad.load({
name: "myApp",
files: [
'ctrl.js',
'iam-not-there.js'
]
});
}]
}
});
$urlRouterProvider.otherwise('/');
});