3

我正在制作一个 POC 来测试 ocLazyLoad 以延迟加载应用程序的各个部分。经过大量调试,我发现 Angular Batarang 在某种程度上与 ocLazyLoad 冲突。

当我延迟加载控制器时,我在拒绝承诺回调时遇到以下错误。

TypeError: Cannot read property 'name' of undefined
    at module.exports (chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:1060:20)
    at chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:1066:7
    at Array.forEach (native)
    at module.exports (chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:1064:21)
    at chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:1360:5
    at Object.invoke (http://localhost/js/library/angular.js:4718:19)
    at callInvoke (http://localhost/js/library/ocLazyLoad.js:317:55)
    at _invokeQueue (http://localhost/js/library/ocLazyLoad.js:322:29)
    at _register (http://localhost/js/library/ocLazyLoad.js:206:21)
    at success (http://localhost/js/library/ocLazyLoad.js:647:37)

路由配置:

 $stateProvider
        .state('home', {
            url: "/",
            templateUrl: 'js/modules/p1/p1.html',
            controller: 'p1Controller as vm',
            resolve: {
                loadMyCtrl: ['$ocLazyLoad', function($ocLazyLoad) {
                    var a = $ocLazyLoad.load('js/modules/p1/p1.js');
                    a.then(function success(args) {
                        console.log('success');
                        return args;
                    }, function error(err) {
                        console.log(err);
                        return err;
                    });
                    return a;
                }]
            }
        });

当我禁用batarang 扩展时,我的延迟加载工作完美。

期待任何一个团队(ocLazyLoad 或 Batarang)的帮助

4

0 回答 0