简体   繁体   English

AngularJS polyfill / Object.assign的替代

[英]AngularJS polyfill/alternative for Object.assign

Failed to instantiate module due to : TypeError: object doesn't support property or method 'assign' at setConfig 由于以下错误而无法实例化模块:TypeError:对象不支持setConfig的属性或方法“ assign”

I'm trying to run an angular app on IE11. 我正在尝试在IE11上运行有角度的应用程序。 And there is a piece of code in details.js file which is throwing an error. 而且details.js文件中有一段代码引发错误。

this.setConfig = (config) => {
    if (config) {
        Object.assign(detailsConfig, config);  
    }
};

Error in the console of IE11 is as below. IE11的控制台错误如下。

[$injector:modulerr] Failed to instantiate module detailsPortal due to: TypeError: Object doesn't support property or method 'assign' at setConfig() [$ injector:modulerr]由于以下原因而无法实例化模块detailsPortal:TypeError:对象不支持setConfig()上的属性或方法“ assign”

Because of this error, my angular app is not loading on IE11, it is displaying a blank screen. 由于这个错误,我的角度应用程序未在IE11上加载,它显示空白屏幕。

Instead of Object.assign , use angular.extend : 代替Object.assign ,使用angular.extend

this.setConfig = (config) => {
    if (config) {
        ̶O̶b̶j̶e̶c̶t̶.̶a̶s̶s̶i̶g̶n̶(̶d̶e̶t̶a̶i̶l̶s̶C̶o̶n̶f̶i̶g̶,̶ ̶c̶o̶n̶f̶i̶g̶)̶;̶ ̶
        angular.extend(detailsConfig, config);  
    }
};

For more information, see 有关更多信息,请参见

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM