index.html导入为angular2 rc.0.1

时间:2016-05-20 04:35:52

标签: angular

我最近将我的ng2应用程序从beta2.0.12升级到rc.0.1。以前我在index.html中有以下导入:

<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/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>

rc.0.1的相应导入是什么。感谢任何指针。

由于

1 个答案:

答案 0 :(得分:2)

好问题首先,我对RC.0中的导入过于混淆,但我找到了答案,

实际上在angular2的RC.0中,system.config.js文件中提到了所有导入, 仔细查看这个文件,你会看到所有的导入

(function (global) {

  var map = {
    ...
    '@angular': 'node_modules/@angular'   // here angular2 bind all the imports of @angular from the node_modules folder itself
                                            instead of importing in the index.html
    ...
  };

  var packageNames = [
    '@angular/common',      //Here all the imports bind by name like from core/common and all...
    '@angular/compiler',
    '@angular/core',
    '@angular/http',
    '@angular/platform-browser',
    '@angular/platform-browser-dynamic',
  // '@angular/router',
    '@angular/router-deprecated',
    '@angular/testing',
    '@angular/upgrade',
  ];

})(this);

因此在RC.0中无需在index.html文件中导入角度为angular.dev/router/http的文件。所有这些 已通过system.config.js文件导入导入。