且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在angular js的现有数组中添加新键?

更新时间:2023-12-01 09:04:16

push 就地操作数组.简单

$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!