How to append to a json object in angular js

后端 未结 3 469
名媛妹妹
名媛妹妹 2021-01-02 01:46

I am having an object like this $scope.releases = [{name : \"All Stage\",active:true}];

I need to append more data to it

[
  {name : \"         


        
3条回答
  •  醉酒成梦
    2021-01-02 02:38

      $scope.releases = [{name : "All Stage",active:true}];
      // Concatenate the new array onto the original
      $scope.releases = $scope.releases.concat([
        {name : "Development",active:false},
        {name : "Production",active:false},
        {name : "Staging",active:false}
      ]);
    

提交回复
热议问题