I recently developed an API using NodeJS. While attempting to fetch data from the API using AngularJS, I encountered an issue where no data is being displayed.
Take a look at my API, which contains data in JSON format. You can access the live link to my API
{"status":"success","data":[{"_id":"58175cb6f0c48b2b9821d799","listen_url":"https://www.youtube.com/watch?v=XSbZidsgMfw","image_url":"https://upload.wikimedia.org/wikipedia/en/thumb/4/41/Yonkers_tyler_cover.jpg/220px-Yonkers_tyler_cover.jpg","producers":"Tyler, The Creator","label":"XL Recordings","artist":"Tyler, The Creator","song_title":"Yonkers ","__v":0},{"_id":"581760e7aa7eb70a8cf0d770","listen_url":"https://vimeo.com/179791907","image_url":"https://upload.wikimedia.org/wikipedia/en/2/2a/Frank_Ocean_Blonde_2.jpg","producers":"Frank Ocean & Om'Mas Keith","label":"Boys Don't Cry","artist":"Frank Ocean","song_title":"Nikes","__v":0},{"_id":"582199b38e7a590871b38893","listen_url":"https://www.youtube.com/watch?v=x4pon-hdEXU","image_url":"https://upload.wikimedia.org/wikipedia/en/thumb/f/fa/Domo_Genesis-The_Alchemist-No_Idols.jpg/220px-Domo_Genesis-The_Alchemist-No_Idols.jpg","producers":"Alchemist","label":"Self Released","artist":"Domo Genesis","song_title":"Elimination Chamber (featuring Earl Sweatshirt, Vince Staples & Action Bronson)","__v":0},{"_id":"58219ae58e7a590871b38894","listen_url":"https://soundcloud.com/defjam/frank-ocean-super-rich-kids","image_url":"https://upload.wikimedia.org/wikipedia/en/thumb/f/f5/Super_Rich_Kids.jpg/220px-Super_Rich_Kids.jpg","producers":"Malay","label":"Def Jam","artist":"Frank Ocean","song_title":"Super Rich Kids (featuring Earl Sweatshirt)","__v":0},{"_id":"58219c0a8e7a590871b38895","listen_url":"https://www.youtube.com/watch?v=0FcDXL5Aw0o","image_url":"https://upload.wikimedia.org/wikipedia/en/thumb/d/d0/Hive-earlsweat.jpg/220px-Hive-earlsweat.jpg","producers":"randomblackdude and Matt Martians","label":"Tan Cressida","artist":"Earl Sweatshirt","song_title":"Hive ( featuring Casey Veggies and Vince Staples)","__v":0},{"_id":"58219f3f8e7a590871b38896","listen_url":"https://vimeo.com/31781199","image_url":"https://upload.wikimedia.org/wikipedia/en/thumb/2/2e/Frank-Ocean-Thinkin-Bout-You-2012.png/220px-Frank-Ocean-Thinkin-Bout-You-2012.png","producers":"Shea Taylor","label":"Def Jam","artist":"Frank Ocean","song_title":"Thinkin Bout You","__v":0},{"_id":"5821a3e88e7a590871b38897","listen_url":"https://vimeo.com/49091270","image_url":"https://upload.wikimedia.org/wikipedia/en/thumb/7/71/Frankoceanpyramids.jpg/220px-Frankoceanpyramids.jpg","producers":"Frank Ocean, Malay and Om'Mas Keith","label":"Def Jam","artist":"Frank Ocean","song_title":"Pyramids","__v":0},{"_id":"582b4010b5a2eb460b850a2c","listen_url":"https://www.youtube.com/watch?v=FCbWLSZrZfw","image_url":"https://upload.wikimedia.org/wikipedia/en/thumb/8/81/Chum_Earl_Sweatshirt.jpg/220px-Chum_Earl_Sweatshirt.jpg","producers":"randomblackdude, Christian Rich & Hugo (Outro)","label":"Tan Cressida","artist":"Earl Sweatshirt","song_title":"Chum","__v":0}]}
Here is my AngularJS code. I am attempting to set up a loop to display all the artists' names along with their song titles:
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<ul>
<li ng-repeat="x in myData">
{{ x.artist + ', ' + x.song_title}}
</li>
</ul>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("https://forgetthis-jafar70.c9users.io").then(function (response) {
$scope.myData = response.data.data;
});
});
</script>
</body>
</html>
I am currently facing an issue and unable to troubleshoot what might be going wrong. Please advise.