ocLazyLoad


#1

Hi,

I am trying to load my controller using ocLazyLoad and it won’t work. The file is loaded and but the component is not.

What’s the best way to lazy loading the controller, directives and etc in ionic.

Please help.

Thank You.


#2

Did you read their doc about ui router?


#3

Yes I did. Here below what I did: THANKS.

$stateProvider.state(‘login’,{
templateUrl:‘views/pages/login.html’,
url:’/login’,
resolve: {
loadMyFiles:function($ocLazyLoad) {
return $ocLazyLoad.load({
name:appName,
files:[
‘js/controllers/login.js’,
‘js/services/UserService.js’,
‘js/services/ErrService.js’
]
})
}
}
});