Background
Started creating a new app using the tabs template. I’m using the Google Feed API to return data. This question is less about Ionic and more about parsing the data returned from an XML feed. The answer, however, would benefit those using both.
FYI - API Documentation: https://developers.google.com/feed/v1/devguide
The Controller
The goal is to have the controller parse a less verbose publishedDate.
.controller("NewsCtrl", function($http, $scope) {
$scope.init = function() {
$http.get("http://ajax.googleapis.com/ajax/services/feed/load", { params: { "v": "1.0", "q": "https://en.blog.wordpress.com/feed/" } })
.success(function(data) {
$scope.rssTitle = data.responseData.feed.title;
$scope.rssUrl = data.responseData.feed.feedUrl;
$scope.rssSiteUrl = data.responseData.feed.link;
$scope.entries = data.responseData.feed.entries;
window.localStorage["entries"] = JSON.stringify(data.responseData.feed.entries);
})
.error(function(data) {
console.log("ERROR: " + data);
if(window.localStorage["entries"] !== undefined) {
$scope.entries = JSON.parse(window.localStorage["entries"]);
}
});
}
$scope.browse = function(v) {
window.open(v, "_system", "location=yes");
}
})
The Template
The template is returning all the values fine but formatting the data is the challenge. I’d copy the output but I can only view the RSS data in the android emulator, atm.
<ion-view view-title="Newsfeed">
<ion-content ng-controller="NewsCtrl" ng-init="init()">
<div class="list">
<a ng-repeat="entry in entries" class="item" ng-click="browse(entry.link)">
<b>{{entry.title}}</b><br>
<span ng-bind-html="entry.contentSnippet"></span><br />
<span>{{entry.author}}</span> <span>{{entry.publishedDate}}</span>
</a>
</div>
</ion-content>
</ion-view>
Question
What should I consult to learn how to parse the data (i.e YYYY / MMM / DD)?
Perhaps, the question is more appropriate for StackExchange but I figured I’d ask here first in case anyone is in a similar boat.
I’m a bit lost in the API documentation here: https://developers.google.com/feed/v1/devguide