How to push one object inside another object in AngularJS?
This question already has an answer here:
var totalData = Object.assign(mainObject, data);
Note that this is a "destructive" (overwriting) update of mainObject
. If you don't want mainObject
to be modified, then do:
var totalData = Object.assign({}, mainObject, data);
链接地址: http://www.djcxy.com/p/27352.html