2016-10-19 8 views
0

私のアプリは次のような構造を持っている:角度1.5、UI-ルータ+リソース+コンポーネント、stateProviderコンポーネントを見つけることができません

app/ 
    js/ 
    levels/ 
      level-create 
      level-edit 
      level-list/ 
        level-list.template.html 
        levellist.component.js 
      level-show/ 
        level-show.template.html 
        levelshow.component.js 
    levels.module.js 

も私は私がすべてのコンポーネントとルートファイルに注入し、基本的なリソースサービスを持っていますlevellist成分と

'use strict'; 
module.exports = angular 
    .module('app.levels.route', []) 
    .config(function($stateProvider) { 
     $stateProvider.state({ 
      component: 'levellist', 
      name: 'levelIndex', 
      url: '/levels', 
      template: '<levellist></levellist>' 
     }).state({ 
      component: 'levelshow', 
      name: 'levelShow', 
      url: 'levels/:id', 
      template: '<levelshow></levelshow>' 
     }); 

    }); 

すべて正常に動作しますが、levelshowと、それだけでこのコンポーネントを見つけることができません...また、私はstateProvider部品の検索エンジンは非常に具体的であることに気付きました。 levelshow.component.js

'use strict'; 
var angular = require('angular'); 

module.exports = angular 
    .module('app.levelsshow.component', ['ngMaterial']) 
    .component('levelshow', { 
     controller: LevelShowController, 
     templateUrl: '/app/js/levels/components/level-show/level-show.template.html' 
    }); 

LevelShowController.$inject = ['Level', '$scope', '$stateParams']; 

function LevelShowController(Level, $scope, $stateParams) { 
    $scope.levelShow = Level.get({ id: $stateParams.id }); 
} 
+0

「クラッシュ」はどのような意味ですか?おそらくログの一部でしょうか? –

+0

ここにマルチモジュールアプリがあります。 levelshowのモジュール 'app.levelsshow.component'を' app.levels.route'に依存関係として注入する必要はありませんか? – tanmay

+0

私の意見では、ルートファイルは次のコンポーネントlevelshowを見つけることができないので、私には何のエラーも表示されません。私はそれをすべて1つのモジュールlevel.module.jsに注入します。私はlevellist.component.jsで動作するように、これらのファイルをすべて必要とします –

答えて

0

はイエス質問がsolwedさがあります。 $ stateProvider.stateでコンポーネントタグをマークする必要はありません

関連する問題