我遵循使用Object.assign
函数
Object.assign(
{},
{
a:1,
b: {
c:{
d: 1,
e: 1
}
}
},
{
a:2,
b: {
c: {
d:2
}
}
}
);
并获得
{
a: 2,
b: {
c: {
d: 2
}
}
}
但我希望得到
{
a: 2,
b: {
c: {
d: 2,
e: 1
}
}
}
即,e
不应该被淘汰。我想保留source1
层次结构中source2
层次结构中不存在的Object.assign
层次结构中的属性。我是否以错误的方式使用$scope.myArray = [{
"pm_id": 2,
"type": "Scrum",
"estimated_end_date": "Wednesday, March 15, 2017",
"no_of_sprints": 2,
"status": "Not Started",
"created_by": "admin@admin.com",
"sprint": [{
"s_id": 4,
"p_id": 35,
"sprint_stage": "Sprint 1",
"sprint_requirement": "description goes here",
"sprint_start_date": "Monday, March 13, 2017",
"sprint_end_date": "Friday, March 17, 2017"
}, {
"s_id": 5,
"p_id": 35,
"sprint_stage": "Sprint 2",
"sprint_requirement": "description goes here",
"sprint_start_date": "Monday, March 20, 2017",
"sprint_end_date": "Friday, March 24, 2017"
}]
}];
?