My JSON array of objects is:
[{
"stateCd": "IL",
"value": "Illinois",
"selected": "false"
},
{
"stateCd": "CA",
"value": "California",
"selected": "true"
},
{
"stateCd": "NY",
"value": "New york",
"selected": "false"
}]
I want to create a new JSON array of objects which should only contain those objects from above array where selected:false.
I've tried concat:
angular.forEach($scope.oldJsonArr, function (value, index) {
if($scope.oldJsonArr[index].selected=="false"){
$scope.newJsonArr.concat($scope.oldJsonArr[index]);
}
});
But this is returning the newJsonArr as undefined.
Any help is appreciated!