I am working on a project where i have to read the product and display it on my HTML page here is my Controller
app.controller('SecondCtrl', function($scope,srvShareCart ,srvShareData,srvAddtoCart,$http) {
$scope.product=[];
$scope.One=function(){
//alert($scope.ids);
$scope.ids= srvAddtoCart.getData();
for (var i=0; i<$scope.ids.length; i++){
$http.get("http://www.ilexsquare.com/JwelTech/wordpress/api.php?function=GetProduct&id="+$scope.ids[i])
.then(function (response) {
srvShareCart.addData(response.data);
});
$scope.cart = srvShareCart.getData();
console.log($scope.cart);
}
}
and here is My HTML page
<div ng-controller="SecondCtrl">
<ul> <li class=oxy-list__item ng-repeat="d in cart">{{d.title}}</li></ul></div>
here is a working API
this the Example API link
it's giving me an error in response.data which is coming as undefined.what is the issue in it ?
I am getting the output but it's not in a form of array.. how do i Add those products in array. i have tried $scope.carts.push($scope.products); but its not storing as an array

Error: JSON.parse: unexpected character at line 1 column 1 of the JSON datathis is the error$scope.ids[i]and what did you get returned if you callhttp://www.ilexsquare.com/JwelTech/wordpress/api.php?function=GetProduct&id="+$scope.ids[i]directly in your browser replaced by the id which was in$scope.ids[i].$scope.ids[i]. I mean have you checked this?