2017-10-02 5 views
1

私はモジュール化が必要なAngularプロジェクトに取り組んでいます。私はそれに対して多くの小さなモジュールを作成します。例:​​、myApp.components.component1myApp.components.component2などはそれぞれ、gulpで1つにコンパイルされた独自のファイルです。私は別のプロジェクトにmyAppを注入すると、私はそうのように、1回のmyAppの注射ですべてのモジュールを消費することができるようにしたい:代わりの1つの注入モジュールの下に複数の角度モジュールをラップする方法

angular.module('project2', ['myApp']) 

:アンギュラチームのような多くの

angular.module('project2', [ 
    'myApp.core', 
    'myApp.components.component1', 
    'myApp.components.component2' 
]) 

をして行っています材料。すべてが独自のモジュールですが、角度材料を使用するには、ngMaterialを依存関係として追加するだけです。

答えて

1
angular.module('project2', ['myApp']); 

    angular.module('myApp', ['components']); 

    angular.module('components', ['component1','component2','component3']); 

    angular.module('component1', []); 
    angular.module('component2', []); 
    angular.module('component3', []); 
+0

ありがとうございました!私はコンポーネントをトップレベルモジュールの実際の依存関係として設定していませんでした。 –

関連する問題