I have an object called
$scope.releases = [{name: "All Stage", active: true}];
Now I want to add more data to it:
[
{name: "Development", active: false},
{name: "Production", active: false},
{name: "Staging", active: false}
]
The final data structure should look like this:
[
{name: "All Stage", active: true},
{name: "Development", active: false},
{name: "Production", active: false},
{name: "Staging", active: false}
]
I attempted the following code, but it doesn't seem to append the new data properly:
app.controller('MainCtrl', function($scope) {
// Initial object
$scope.releases = [{name: "All Stage", active: true}];
// Adding more data
$scope.releases = [
{name: "Development", active: false},
{name: "Production", active: false},
{name: "Staging", active: false}
]
});
Plunker Link: http://plnkr.co/edit/gist:3510140