无法让Angular2组件在Internet Explorer中运行

时间:2016-02-03 16:07:38

标签: html internet-explorer-11 angular

我的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中得到错误。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

最后有workaround for the issue(第2条评论)。

对我有用的是包含脚本“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>