Angular2在IE9中不起作用

时间:2017-06-08 09:57:56

标签: angular internet-explorer-9

我有一个angular2项目,它适用于Chrome e IE11。

我试图在IE9上运行所有内容,但没有正确加载页面,我控制了以下错误:

  

SCRIPT5007:对象需要polyfills.bundle.js,第8894行   2`

这是我的index.html

<!doctype html>
    <html>
    <head>
      <meta charset="utf-8">
      <title>Title</title>
      <base href="/">

      <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
      <link rel="icon" type="image/x-icon" href="favicon.ico">
      <script src="assets/js/jquery-1.12.1.min.js"></script>
      <script src="assets/js/jquery-ui.js"></script>
      <script src="node_modules/core-js/client/shim.min.js"></script>
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">


      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
      <!--[if lte IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <script src="/node_modules/zone.js/dist/zone.js"></script>
      <!--<![endif]-->

    </head>
    <body>            
       <app-root >Loading...</app-root>           
    </body>
    </html>

这就是package.json

{
  "name": "angular-p",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --proxy-config proxy.config.json",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^2.4.0",
    "@angular/compiler": "^2.4.0",
    "@angular/core": "^2.4.0",
    "@angular/forms": "^2.4.0",
    "@angular/http": "^2.4.0",
    "@angular/platform-browser": "^2.4.0",
    "@angular/platform-browser-dynamic": "^2.4.0",
    "@angular/router": "^3.4.0",
    "angular2-modal": "^2.0.3",
    "bootstrap": "3.3.7",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "intl": "^1.2.5",
    "ng-select": "^1.0.0-beta.4",
    "ng2-validation": "^4.0.0",
    "ngx-mydatepicker": "^0.1.5",
    "rxjs": "^5.1.0",
    "web-animations-js": "^2.2.2",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0",
    "@angular/compiler-cli": "^2.4.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.0.0"
  }
}

我不知道如何修复它。请帮帮我!!

1 个答案:

答案 0 :(得分:0)

我的建议是包括Babel:

"babel-cli": "^6.16.0",
"babel-preset-angular2": "^0.0.2",
"babel-preset-es2015": "^6.16.0",
"babel-polyfill":"6.23.0",

确保将它们包含在您的bundle.js中