How do I ensure that the object inherits all properties from another object?
Here is the code snippet:
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 method does not work as expected
});
}
If successful, update the object value accordingly.