Retrieve an object from the server that resembles the following structure:
"courses": [
{
"id": 1,
"name": "piano",
"classes": [
{
"id": 1,
"name": "piano1",
},
{
"id": 2,
"name": "piano2",
}
],
"classes_count": 2,
"feedbacks_count": 4
},
]
JavaScript: Fetching data into Scope
httpService.getService(url, data).then(function(res) {
$scope.datas = res.body.courses;
console.log($scope.datas);
})
I want to display classes id using ng-repeat. How can I achieve this?
<ul class="dropdown-list" style="display: none;">
<li ng-repeat="course in datas | filter:{'id': showprofile}:true ">{{course.classes.id}}</li>
</ul>
The above code only works when I print {{course.classes}}, which gives me an array of 2 objects. How can I access course.classes.id inside the "li" element?