How do I parse in $
from JSON HTTP responses in AngularJS?
Trying to grab YouTube search results without JQuery:
$http.get('http://gdata.youtube.com/feeds/api/videos/-/chocolate?alt=json&orderby=published')
.success(function (data) {
$scope.video_list = data;
})
.error(function (data) {
$scope.video_list = data;
});
No error response from that one, get an Object when consoling it; but cannot query within it.
$scope.video_list_fun = function () {
$http.get('http://gdata.youtube.com/feeds/api/videos/-/chocolate?alt=json&orderby=published').then(function (response) {
$scope.video_list = response.data;
});
};
Same here, have tried with ,
chained else
also.
$scope.video_list = (httpGet('http://gdata.youtube.com/feeds/api/videos/-/chocolate?alt=json&orderby=published'
)); // HttpGet from http://stackoverflow.com/a/4033310/587021
This works, but when I parse it, e.g.: with JSON.parse
; AngularJS gets rid of all the keys with $
in them.
Should note that I have tried with their other API, but wasn't able to get the same results (and can't include their useful args for published date and quality; because it's broken).