I am new to the web Development. I do have an json obj which is like
$scope.jsonData = {
"messages": {
"A": [{
"missingFields": [{
"RESPONSIBILITY": ""
}],
"temporaryId": 2,
"messages": "",
"id": 2,
"content": ""
}, {
"missingFields": [{
"RESPONSIBILITY": ""
}],
"temporaryId": 3,
"messages": "",
"id": 3,
"content": ""
}, {
"missingFields": [{
"RESPONSIBILITY": ""
}],
"temporaryId": 4,
"messages": "",
"id": 4,
"content": ""
}],
"B": [{
"missingFields": [{
"CITY": ""
}, {
"PINCODE": ""
}],
"messages": "No Address details found.",
"id": -1,
"content": ""
}]
}
}
Now I want to iterate through this object and I want to get the "RESPONSIBILITY"
field.Here I tried like -
for (var i=0; i < $scope.jsonData.messages.length; i++) {
}
But it is giving the length of the messages as undefined
. SO, and also I want to use that in the angular code . I used like -
ng-repeat="suggestion in jsonData.messages
Can any one please explain me this . I searched a lot and tried so I am asking this question.