2016-03-24 35 views
1

根據此thread,我包括ng2-bs3-modal用於在angular2中創建模態。由於ng2-bs3-modal和它加載的js文件(如modal.js,modal-header.js)默認不會將.js作爲它們的擴展名,所以我必須使用deafultJsExtension:true來實現它。爲了防止根據該相同線程的角度誤差(角度被再次加載其模塊在瀏覽器)中,i包括system.config加載systemjs,而不是裝載angularjs後寫它後直接,angular2 - 無法找到瀏覽器,corejs

<script src="node_modules/es6-shim/es6-shim.min.js"> 
    </script> 
    <script src="node_modules/systemjs/dist/system-polyfills.js"> 
    </script> 
    <script src="node_modules/systemjs/dist/system.src.js"> 
    </script> 
    <!-- 2. Configure SystemJS --> 
    <script> 
     System.config({ 
      defaultJSExtensions: true, 
      packages: { 
      angular: { defaultExtension: false }, 
      app: { 
       format: 'register', 
       defaultExtension: 'js' 
      }, 
      }, 
      map: { 
       'ng2-bs3-modal': 'node_modules/ng2-bs3-modal', 
      } 
     }); 
     System.import('node_modules/jquery/dist/jquery.min.js') 
     System.import('node_modules/bootstrap/dist/js/bootstrap.min.js'); 
     System.import('app/js/main') 
     .then(null, console.error.bind(console)); 
    </script> 
    <script src="node_modules/angular2/bundles/angular2-polyfills.js"> 
    </script> 
    <script src="node_modules/rxjs/bundles/Rx.js"> 
    </script> 
    <script src="node_modules/angular2/bundles/angular2.dev.js"> 
    </script> 

現在,有時它工作正常,有時它說browser.js,core.js沒有找到,也system.js錯誤

(在控制檯中說GET GET http://localhost:3000/angular2/core.js 404(未找到) - system.src.js:1068 聲明失敗:加載或加載 - system.src.js:291

有人可以識別此 感謝

回答

0

好了,答案是從錯誤相當明顯的,我不得不寫一張地圖angular2以及:: -

map: { 
     'ng2-bs3-modal': 'node_modules/ng2-bs3-modal', 
     'angular2': 'node_modules/angular2' 
    } 

也許這有文件和填充工具的順序做腳本加載,但這個序列是從我在互聯網上閱讀的來源中獲得的,並且沒有寫到我們可能遇到這樣的錯誤。

這是發生在大家都對嗎?還是隻是我

相關問題