无法在 Internet Explorer 中将 Angular2 组件获取到 运行

Can't get Angular2 component to run in Internet Explorer

我的 Angular2 应用程序可以在 Chrome、Firefox 和 Safari 中运行,但不能在 Internet Explorer 中运行。它在 angular2.min.js 中发现错误:SyntaxError: Expected ';'

这是我的 HTML 文件:

<!DOCTYPE html>
<html>
  <head>
    <title>My Component</title>
    <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/bundles/angular2-polyfills.js"></script>    
    <script src="../../../../node_modules/systemjs/dist/system.src.js"></script>
    <script src="config.js"></script>    
    <script src="../../../../node_modules/rxjs/bundles/Rx.min.js"></script>    
    <script src="../../../../node_modules/angular2/bundles/angular2.min.js"></script>        
    <script>
      System.import("./app/main").catch(console.log.bind(console));
    </script>
  </head>
  <body>
    <my-comp></my-comp>
  </body>
</html>

这与Angular的5 Min Quickstart中的HTML基本相似,但我在IE中仍然出现错误。有什么想法吗?

终于有一个workaround for the issue(第二条评论)。

对我有用的是包含脚本“https://npmcdn.com/angular2/es6/dev/src/testing/shims_for_IE.js”:

<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="https://npmcdn.com/angular2/es6/dev/src/testing/shims_for_IE.js"></script>

<script src="node_modules/systemjs/dist/system-polyfills.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>