无法使用Object.assign()保存AnjularJS模型

时间:2019-05-29 17:43:22

标签: javascript angularjs angularjs-directive controller angular-ui-router

我正在尝试使用以下语句将模型保存到mongo集合中

...
        createRecord: (body) => {
            console.log("Hello you are in createRecord : " );
            let sEntry = new SAudit(Object.assign({}, body ));
            console.log("Hello: " + body );
            console.log("Hello before saving: " + sEntry );
           return sEntry.save();
        }
...

在这里,sEntry仍然是空白,即使执行了Object.assign({}, body )

console.log始终为空白 Hello before saving: { notes: [] }

好像我需要替换let sEntry = new SAudit(Object.assign({}, body ));

0 个答案:

没有答案