javascript - Angular 2+ : Internet Explorer: Unable to get property 'call' of undefined or null reference

标签 javascript angular typescript webpack angular-cli

在 Angular 4.2.4(Angular-CLI 1.1.3)中,IE11 我得到 SCRIPT1002: Syntax errorSCRIPT5007: Unable to get property 'call' of undefined or null reference。我有我的 polyfill,我会假设 Webpack 和 Angular-CLI 会完成剩下的工作。我在这里缺少什么?

Unable to get property 'call' of undefined or null reference 在它之后说:bootstrap 50034e0a1f93dabcb117 (54, 1) 没有指示真实文件名。 Syntax error 说它在 vendor.bundle.js (63117,26) 中,看起来像:

window.setTimeout(() => {
    window.removeEventListener('click', suppressClick, true);
}, 0);

更新:之前对我来说应该更明显,但这看起来像 ES6 代码,应该编译成 ES5。

最佳答案

如评论中所述,这里可能存在很多问题,但我最近遇到浏览器兼容性问题,解决方案是使用 polyfills .取消注释以下行:

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

然后运行您的应用程序。它应该工作到 IE10 至少它对我们有用。根据错误消息,它可能也适用于您。

关于javascript - Angular 2+ : Internet Explorer: Unable to get property 'call' of undefined or null reference,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44531082/

相关文章:

javascript - 在功能组件中使用 useSelector 时无效的 Hook 调用

javascript - 如何在 JavaScript 中创建指针

javascript - 如果 Iframe 无法加载 Angular 中 src 处的资源,如何显示替代文本

Angular2 - 带有表单的模态

javascript - 当另一个数据更新时,Angular 2更新数据

javascript - 使用javascript过滤剪切/复制选择?

javascript - CSS、JavaScript、HTML,如何将 div 内的文本与图像旁边的中间对齐?并为文字添加动画

angular - 从 7.2.15 : minTimeout is greater than maxTimeout 升级 Angular 时出错

Typescript 无法将对象字面量分配给泛型类型

javascript - 如何以 react 形式存储 bool 值?