1、angularJS懒加载依赖模块
//设置
.config [
'$ocLazyLoadProvider'
($ocLazyLoadProvider) ->
# We configure ocLazyLoad to use the lib script.js as the async loader
$ocLazyLoadProvider.config
debug: true
events: true
modules: [
{
name: 'ui.grid'
files: [
'//cdn.bootcss.com/angular-ui-grid/3.1.1/ui-grid.js'
]
}
]
return
]
//路由
.state 'admin.user.123', {
url: '123/'
templateUrl: '123.html'
controller: '123Ctrl'
resolve: {
deps: ['$ocLazyLoad',
($ocLazyLoad)->
return $ocLazyLoad.load('ui.grid').then(
()->
return $ocLazyLoad.load('123Ctrl.js')
)
]
}
data: {title: '123'}
}