2016-09-12 4 views
1

Angular/Webpack/ocLazyLoadアプリを動作させようとしています。私のアプリケーションコードは次のようになります:

var app = angular.module('app', ['oc.lazyLoad', 'ngComponentRouter']); 
app.config(function ($locationProvider) { 
$locationProvider.html5Mode(true); 
}); 

app.value('$routerRootComponent', 'app'); 

app.component('app', { 
template: [ 
'<a ng-link="[\'Home\']">Home</a> |', 
'<a ng-link="[\'Heroes\']">Heroes</a> |', 
'<a ng-link="[\'CrisisCenter\']">Crisis Center</a>', 
'<hr>', 
'<ng-outlet></ng-outlet>', 

].join('\n'), 

controller: ['$router', '$ocLazyLoad', function($router, $ocLazyLoad) { 

$router.config([ 
    {path: '/', name: 'Home', component: 'home', usaAsDefault: true}, 

    //Heroes Route 
    { 
     path: '/heroes/...', 
     name: 'Heroes', 
     loader: function() { 
      // lazy load Heroes 
      /*return $ocLazyLoad.load([require('heroes.module')]) 
       .then(function() { 
        return 'heroes'; 
       });*/ 
     } 
    }, 

    //Crisis Center Route 
    { 
     path: '/crisis-center/...', 
     name: 'CrisisCenter', 
     loader: function() { 
      // lazy load CrisisCenter 
      /*return $ocLazyLoad.load([require('')]) 
       .then(function() { 
        return 'crisisCenter'; 
       });*/ 
     } 

    } 

    ]); 
}] 

}); 

$ routerについては不明なプロバイダエラーが表示されます。コードは完全にデバッグして自分のコードの特定のポイントに到達しますが、Webpackで動作させることはできません(実装前に動作しました)

ありがとうございます!

答えて

0

$routerから$rootRouterを変更すると問題が解決しました。

関連する問題