Discussions

Ask a Question
Back to All

lazy load

i have a dashboard which users two controllers and these two controllers are in different file. can i know how to load two controllers using lazyload. below is the code which i have altered by does not work firsttime. when i open the page that uses the second controller and close then the dash board works fine.

.state('dashboard.home',{
url:'/home',
controller: 'MainCtrl',
templateUrl:'views/dashboard/home.html',
resolve: {
loadMyFiles:function($ocLazyLoad) {
return $ocLazyLoad.load({
name:'sbAdminApp',
files:[
'scripts/controllers/main.js',
'scripts/directives/timeline/timeline.js',
'scripts/directives/notifications/notifications.js',
'scripts/directives/chat/chat.js',
'scripts/directives/dashboard/stats/stats.js'
]
})
$ocLazyLoad.load({
name:'sbAdminApp',
files:['scripts/controllers/pvContoller.js']
})
}
}
})