Friday 15 March 2013

javascript - How an angular object gets the value of another object -



javascript - How an angular object gets the value of another object -

how can create object inherit properties other object.

this code:

this.makeready = function(order) { var temporder = angular.copy(order); temporder.status = 1; angular.foreach(temporder.items, function(item){ item.status = 1; }) homecoming $http.put('/rest/change/invoice/'+order.id+'/', temporder).success(function(){ order = temporder; // doesn't work }); }

in case of success: alter value of object.

try straight edit order in $scope.allorders , see if gets behavior looking for.

this.makeready = function (order) { var temporder = angular.copy(order); var orderindex = $scope.allorders.indexof(order); temporder.status = 1; angular.foreach(temporder.items, function(item) { item.status = 1; }); homecoming $http.put('/rest/change/invoice/' + order.id + '/', temporder).success(function () { $scope.allorders[orderindex] = temporder; }); }

javascript arrays angularjs object angularjs-scope

No comments:

Post a Comment