When making a rest call in AngularJS, I encountered an issue where I was able to retrieve simple key-value pairs from the response, but struggled with extracting values from arrays within the response in my AngularJS controller.
Here is a snippet of my code (comments are not included).
Rc.all('demo/example/db/').get('quues/').then(function(res)
{
$scope.demo={}
$scope.demo.details={
value1 : res.Ksus.Type.Master.Origin.ID,
}
$scope.array={}
$scope.array.arrValue={
arrVal : res.Asus[0].AsuID,
}
}
JSON:
{
_id:123
Ksus: {
Type: {
Master: {
Origin: {
ID: "Demo"
}
}
}
},
Asus: [{
AsuID: "f4",
Type: "SU",
}]
}
In my controller, I am able to access simple key-value pairs like ID: "Demo", but struggling to retrieve array values such as AsuID. The attempt to extract it using arrVal : res.Asus[0] results in the console showing undefined. Any assistance on how to resolve this issue would be greatly appreciated. Thank you in advance.