As a beginner, I have been tasked with incorporating an RSS feed into an Angular/Ionic project. The options are to either parse the RSS feed manually or utilize an external tool like the Google Feed API.
I have developed a service to retrieve the data, which is then utilized by an Angular controller.
Here is the code for the service:
.factory('rssReader', ['$http', function($http) {
return $http.get('URL_HERE')
.success(function(data) {
alert("SUCCESS!!!" + data);//return data;
})
.error(function(data) {
alert("FAILED!!!!" + data);//return data;
});
}]);
When using this CodeCademy URL, I receive a "SUCCESS" alert and obtain JSON data:
However, when attempting to access this Google Feed API URL, I am getting null as the result. Here is an example URL:
http://ajax.googleapis.com/ajax/services/feed/load?v=2.0&q=http://rss.cnn.com/rss/cnn_topstories.rss&num=5
I have come across different approaches online, but I am struggling to understand why this particular method is not yielding the desired outcome.
- What could be causing the issue?
- What are some helpful tips and tools for debugging in this scenario?
Being new to Angular and JavaScript, any assistance would be greatly appreciated. Thank you!