Last active
December 2, 2015 09:43
-
-
Save bettysteger/3dd336f5a9a10a2dd383 to your computer and use it in GitHub Desktop.
Fetching feed in Angular
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BEFORE | |
var feedUrl = 'https://lingohub.com/blog/feed/rss2'; | |
$http.jsonp('https://ajax.googleapis.com/ajax/services/feed/load', {params: {v: '1.0', q: feedUrl, num:-1, callback:'JSON_CALLBACK'}}).success(function(data) { | |
$scope.entries = data.responseData.feed.entries; | |
angular.forEach($scope.entries, function (entry) { | |
entry.publishedDate = new Date(entry.publishedDate); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AFTER | |
$http.jsonp('https://lingohub.com/blog/feed/json', {cache: true, params: {callback:'JSON_CALLBACK'}}).success(function(data) { | |
$scope.entries = data; | |
angular.forEach($scope.entries, function (entry) { | |
entry.publishedDate = new Date(entry.date); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment