答案 0 :(得分:2)
执行此操作的 Angular方式是使用Angular.extend
var merged_object = angular.extend({}, $scope.test1, $scope.test2)
console.log(merged_object)
答案 1 :(得分:1)
angular.forEach()会解决您的问题
var obj1 = {a:"hello",b:"user1",c:"user2"},obj2={a:"hello",b:"user1"};
angular.forEach(obj1,function(value,key){
angular.forEach(obj2,function(value2,key2){
if(key2 === key){
delete obj[key];
}
})
});