【问题标题】:IE 11 compatibility errors using Angular 5使用 Angular 5 的 IE 11 兼容性错误
【发布时间】:2018-09-22 10:28:04
【问题描述】:

我已经构建了我的 Angular 应用程序,然后在服务器中运行它。

我遇到了本地主机中未显示的错误。

Unable to get property 'onHover' of undefined or null reference.

文件Chart.min.js,线:10,冒号:115187

Error “SCRIPT 1028 Expected identifier, string or number”

文件 polyfills.bundle.js,ligne:6399,colonne:5

Object doesn't support property or method 'querySelector

文件styles.bundle.js,线:215,冒号:2

Expected identifier

文件:vendor.bundle.js,ligne:3169,colonne:23

我在 polyfills.ts 中有未注释的导入

/** 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';

//import 'classlist.js';  // Run `npm install --save classlist.js`.
import 'core-js/es7/reflect';

// import 'web-animations-js';  // Run `npm install --save web-animations-js`.
import 'zone.js/dist/zone';  // Included with Angular CLI.

这是加载应用时的网络流量

【问题讨论】:

  • 在其他浏览器中也可以使用?
  • 是的,在 Chrome 和 Firefox 中可以正常工作
  • 那我猜这个问题可能是因为polyfill加载得太晚了?
  • 我添加了网络流量截图

标签: angular internet-explorer internet-explorer-11 polyfills


【解决方案1】:

在 index.html 中添加元标记。这也是一条必经之路。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-17
    • 1970-01-01
    • 2019-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-18
    • 2012-07-12
    相关资源
    最近更新 更多