将angular2软件包升级到以下版本后,出现以下错误:
错误:Unable to get property 'apply' of undefined or null reference
我在IE11中仅收到此错误,在Chrome中工作正常。
我做了一些挖掘,导致错误的行在angular / common模块中:
function combine(options) {
return (_a = ((Object))).assign.apply(_a, [{}].concat(options));
var _a;
}
打字稿文件:
@ angular / common / src / pipes / intl.ts第175行
function combine(options: Intl.DateTimeFormatOptions[]): Intl.DateTimeFormatOptions {
return (<any>Object).assign({}, ...options);
}
调用该combine
函数的代码是@ angular / common / src / pipes / intl.ts第48行:
'yMMMdjms': datePartGetterFactory(combine([
更新
似乎实际的错误是该.assign
方法未在IE11中实现
如果您正在使用@angular/cli
并打算支持IE9-11,则可以编辑src/polyfills.ts
文件以启用适当的polyfill。所需的polyfill已在文件中,因此您只需取消注释即可。
默认情况下,@angular/cli
项目以开箱即用的“常绿”浏览器为目标,这意味着不立即支持IE,但是您可以通过导入所需的功能的polyfill添加支持。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句