2016-02-03 14 views
1

這是user.route.js只有一個角度來看塊執行

(function() { 
'use strict'; 


angular 
    .module('app.user' , []) 
    .run(appRun); 

function appRun(routerHelper) { 
    console.log("-----------------------------------"); 
})(); 

我的第一次運行塊和user.cache.js

(function(){ 
'use strict'; 

angular 
    .module('app.user' , []) 
    .run(test); 

function test(){ 
    console.log("test +++++++++++++++++++++++++++++++++++++++++"); 
})(); 

但只在第一次運行的代碼是我的第二次運行塊執行。顯示器是:

+++++++++++++++++++++++++++++++++++++ 

回答

4

你完全在那裏重新定義你的app.user模塊。
如果你想更多的項目附加到現有的模塊,離開了第二個參數爲.module()

angular.module('app.user').run(..)