How can I make the object inherit all the properties from the other object.
This is the code:
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
});
}
In case of success: change the value of that object.
$scope.order = tempOrder;in your success function.$scope.allOrderscontains all orders, so when i changeorderit will affect on allOrders..