【问题标题】:AngularJS polyfill/alternative for Object.assignAngularJS polyfill/Object.assign 的替代品
【发布时间】:2019-08-07 06:53:43
【问题描述】:

未能实例化模块,原因是:TypeError: object does not support property or method 'assign' at setConfig

我正在尝试在 IE11 上运行 Angular 应用程序。而且 details.js 文件中有一段代码抛出错误。

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

IE11控制台报错如下。

[$injector:modulerr] 无法实例化模块 detailsPortal 由于: TypeError:对象不支持属性或方法“分配” 在 setConfig()

由于这个错误,我的 Angular 应用程序没有在 IE11 上加载,它显示一个空白屏幕。

【问题讨论】:

标签: javascript angularjs


【解决方案1】:

angular.extend代替Object.assign

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);  
    }
};

有关详细信息,请参阅

【讨论】:

    猜你喜欢
    • 2014-11-02
    • 2017-10-02
    • 1970-01-01
    • 2015-01-24
    • 2016-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-23
    相关资源
    最近更新 更多