在Angular 4.2.4(Angular-CLI 1.1.3(中,IE11我得到了SCRIPT1002: Syntax error
和SCRIPT5007: Unable to get property 'call' of undefined or null reference
。我有我的 polyfills,我会假设 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。
正如评论中提到的,这里可能存在很多问题,但我最近遇到了浏览器兼容性问题,解决方案是使用 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';
并运行您的应用程序。它应该工作到IE10
至少它为我们工作。根据错误消息,它也可能对您有用。
尝试从资产加载 jQuery polyfills:
在索引.html的头上:
<script src="assets/...">
我的看法是至少尝试 https://plugins.jquery.com/webshims/
对于仍然遇到此问题的任何人,请尝试以下操作:
角度 2+:IE 11 无法获取未定义或空引用的属性"调用">
如果您收到的错误发生在如下所示的大量代码上:
window.setTimeout(() => {
window.removeEventListener('click', suppressClick, true);
}, 0);
。那么请让我知道解决方案是否有效。我将更新此答案,并可能将此问题标记为重复。
我不认为这些是目前相同的问题,因为错误发生在bundle.js
中的不同代码上。有人投票否决了这个答案,但没有就这些问题是否有相同的解决方案给出任何反馈。
我目前没有办法对此进行测试,但想引导人们找到可能的解决方案。