Skip to content Skip to sidebar Skip to footer

How To Add New Key In Existing Array In Angular Js?

I have define blank array $scope.order, ON form submit data get and create new array then merge with existing array. .controller('GuestDetailsCtrl',function($scope){ $scope.ord

Solution 1:

push operates on the array in-place. Simply

$scope.order = [];
$scope.itemDetails = function() {
    // Here data get after form submiti have array arrieve from form submit.$scope.order.push({name:$scope.item.name,price:$scope.item.price});
}

(without assigning it), and that should work!

Post a Comment for "How To Add New Key In Existing Array In Angular Js?"