I'm using ocLazyLoad and initialize it at ui-router resolve:
$stateProvider
.state('user', {
url: '/user',
resolve: {
loader: ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load('app/user/user.app.js');
}]
}
})
.state('admin', {
url: '/admin',
resolve: {
loader: ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load('app/admin.app.js');
}]
}
})
The problem is when I first reload the page (to /admin
), it works perfectly. But if i go to /user
(still load) and back again to /admin
the JS won't load. and still using /user
js.
I've tried add cache:false
for every route stil not working.
Any solution?