例如,从这两个对象中:
我希望你能帮我翻译这个内容(对象2覆盖对象1,除了空属性或他没有的属性):
var object1 = {
"color": "yellow",
"size" : null,
"age" : 7,
"weight" : null
}
var object2 = {
"color": "blue",
"size" : 51,
"age" : null
}
我希望你能帮我翻译这个内容(对象2覆盖对象1,除了空属性或他没有的属性):
{
"color": "blue",
"size" : 51,
"age" : 7,
"weight" : null
}
angular.extend(object1, object2)可以使用,但会将age属性覆盖为null。