I have JSON output in the below format.{
data{
"id" : 1,
"age":20,
"subjects":[
{"code":"101", "Lecturer":"Doe"},
{"code":"102", "Lecturer":"Smith"},
{"code":"103", "Lecturer":"Jones"}
]
}
I tried the following code to loop through subjects from data object.
$scope.values=[];
angular.forEach(data.subjects,function(value,key){
$scope.values.push(value.Lecturer);
});
I don't see any values in data.subjects in forEach loop to iterate.What elsei am missing in the code?