我试图使用LazyLoad但不加载控制器
$routeProvider
.when('/', {
templateUrl : 'pages/calendar/week/page.html',
controller:'MainCtrl',
resolve: {
lazy: ['$ocLazyLoad', function($ocLazyLoad) {
return $ocLazyLoad.load([{
name: 'app',
files: [
'/pages/calendar/week/controller.js',
]
}]);
}]
}
})
有什么建议吗?
答案 0 :(得分:0)
我也使用延迟加载,但没有名称/文件参数:
var interfaceApp = angular.module('interfaceApp', [ 'ngRoute','oc.lazyLoad' ]);
interfaceApp.config(['$routeProvider',
function ($routeProvider) {
$routeProvider.
when('/', {
templateUrl: 'partials/home/home.html',
controller: 'homeController',
resolve: {
lazy: ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load({files: ['js/controllers/homeController.js']});
}]
}
}).
otherwise({
redirectTo: '/'
});
}]);
答案 1 :(得分:0)
如果您将控制器定义为angular.module('interfaceApp').controller(...)
interfaceApp.controller(...)