As a newcomer to Angular and JSON calls, I must admit that I am still learning the ropes.
My current task involves making a $http.get call to retrieve data from a JSON object. Here is an example of what the JSON object looks like:
[{
path: "site:images/gallery/1238.jpg",
data: {
caption: "",
url: ""
}
}, {
path: "site:images/gallery/abelone.jpg",
data: {
caption: "",
url: ""
}
}, {
path: "site:images/gallery/carrot.jpg",
data: {
caption: "",
url: ""
}
},
//more objects follow
]
This is how I am calling the data:
$http.get('/_admin/index.php/rest/api/galleries/get/Restaurant?token=xxx')
.then(function(response) {
$scope.gallery = response.data;
});
To display the retrieved data using ng-repeat:
<article ng-repeat="item in gallery">
<p>{{item.path}}</p>
</article>
One challenge I'm facing now is figuring out how to remove the 'site:' keyword from each 'path' record.