【发布时间】:2013-12-02 23:03:57
【问题描述】:
我有这样的对象$scope.releases = [{name : "All Stage",active:true}];
我需要添加更多数据
[
{name : "Development",active:false},
{name : "Production",active:false},
{name : "Staging",active:false}
]
所以最终的数据应该是这样的
[
{name : "All Stage",active:true}
{name : "Development",active:false},
{name : "Production",active:false},
{name : "Staging",active:false}
]
我尝试了以下代码。但它没有附加。
app.controller('MainCtrl', function($scope) {
// I am having an object like this
$scope.releases = [{name : "All Stage",active:true}];
// I need to appned some more data to it
$scope.releases = [
{name : "Development",active:false},
{name : "Production",active:false},
{name : "Staging",active:false}
]
});
Pluker 链接:http://plnkr.co/edit/gist:3510140
【问题讨论】:
标签: javascript json angularjs append