如何使對象繼承其他對象的所有屬性。角度對象如何獲取另一個對象的值
這是代碼:
this.makeReady = function(order) {
var tempOrder = angular.copy(order);
tempOrder.status = 1;
angular.forEach(tempOrder.items, function(item){
item.status = 1;
})
return $http.put('/rest/change/invoice/'+order.id+'/', tempOrder).success(function(){
order = tempOrder; // this doesn't work
});
}
在成功的情況下:改變該對象的值。
你傳遞給makeReady函數的order參數是什麼?如果它是$ scope.order,那麼只需在你的成功函數中使用'$ scope.order = tempOrder;'。 – adam0101 2014-10-10 18:05:01
'$ scope.allOrders'包含所有訂單,所以當我更改'訂單'時,它將影響所有訂單.. – 2014-10-10 21:03:33