在 Angular 4.2.4(Angular-CLI 1.1.3)中,IE11 我得到 SCRIPT1002: Syntax error
和 SCRIPT5007: 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/