Angular 7 项目在 Internet Explorer 11 中不工作

标签 angular internet-explorer

我已经完成了互联网上不同帖子中提到的所有操作,但我的问题仍然存在。

我取消了对 IE 9、10、11 所需的 polyfill 的注释

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';

我在 index.html 中应用了元标记

<meta http-equiv="X-UA-Compatible" content="IE=edge" >

但我在 IE 11 中工作时仍然遇到错误:

  • SCRIPT438:对象不支持属性或方法“绑定(bind)” runtime.js(208,11)

  • SCRIPT1010:预期标识符 polyfills.js (3846,36)

  • SCRIPT1010:预期标识符 styles.js (310,24)

  • SCRIPT1028:预期标识符、字符串或数字 vendor.js (298,5)

  • SCRIPT1010:预期标识符 main.js (1424,32)

编辑 1 这是我的 tsconfig.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ],
    "paths": {
      "jszip": [
        "../node_modules/jszip/dist/jszip.min.js"
      ]
    }
  }
}

我该怎么办?

如有任何帮助,我们将不胜感激。

最佳答案

我通过以下 4 个步骤解决了这个问题! 对你来说,从第 3 步开始。

  1. 在你的项目中找到 polyfill.ts

  2. 取消注释所有已注释的导入 - 保存

  3. 在 npm 下安装

    • npm install --save classlist.js
    • npm install --save web-animations-js
  4. 服务

信用:https://blog.angularindepth.com/angular-and-internet-explorer-5e59bb6fb4e9

++如果你使用的是angular8 请参阅 : https://stackoverflow.com/a/59317315/10109195

关于Angular 7 项目在 Internet Explorer 11 中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55647043/

相关文章:

javascript - Angular 2 Webpack 2 - Sass 在组件中不起作用

Javascript:使用 IE 调试时出现 "Source Code is not available for this location"消息

html - 本地存储在一个 html 文件中,无需访问互联网

css - 哪些 Internet Explorer 设置会导致 IE7/IE8 不加载 css?

css - IE 8,9 z-index 错误

node.js - Mongoose Middleware pre 'remove' 不起作用,Model.update 不是函数

angular - 使用 index.html 离线运行 Angular 7 Web 应用程序

Angular 6 - 获取 FormGroup 上所有更改的值

javascript - 我如何在 Angular 4 中像 Firefox 一样使用 chrome 选择相同的文件

JavaScript .click() 在 IE 中不起作用