我一直在使用oclazyload来缩短响应时间。在加载homeController时,我可以看到它已经通过oclazyload加载到网络选项卡中。但是调用html页面时不会触发控制器。我得到的错误如下:
Error: [ng:areq] http://errors.angularjs.org/1.3.12/ng/areq?p0=homeController&p1=not%20aNaNunction%2C%20got%20undefined
我的路线配置:
$routeProvider.when('/',
{
templateUrl: 'app/components/home/home.html',
controller: 'homeController',
resolve:
{ // Any property in resolve should return a promise and is executed before the view is loaded
loadMyCtrl: ['$ocLazyLoad', function($ocLazyLoad) {
// you can lazy load files for an existing module
return $ocLazyLoad.load('app/components/home/homeController.js');}]}});
我该如何解决这个问题?