I'm trying to create an AngularJS app that will take a feed and reformat it so I can display certain portions of a blog written by me on a page without EVERYTHING on the blog. To start with I am just trying to get the blog feed down and display post titles, I'm using the slashdot feed as a test.
This is my first angular project so I looked around for something similar to use as a bit of a template and found this: http://www.jdev.it/a-very-simple-rss-reader-with-angularjs-and-google-feed-api/
JS:
var feedList = [];
var app = angular.module('FeedReader',['ngResource']);
app.factory('feedLoader',['$resource', function($resource){
var googleAPI = $resource('http://ajax.googleapis.com/ajax/services/feed/load',{},{ collect: { method: 'JSONP', params: { v: '1.0', callback: 'JSON_Callback' } } });
return googleAPI;
}]);
app.service('createFeedList',['feedLoader', function(feedLoader){
this.get = function(){
var feed = {
feedName: 'Slashdot',
feedURL: 'http://rss.slashdot.org/Slashdot/slashdot'
};
feedLoader.collect({q: feed.feedURL, num: 10},{},function(results){
var results = data.responseData.feed;
feedList.push(results);
});
};
return feedList;
}])
app.controller('blogCtrl',['$scope','createFeedList', function($scope, createFeedList){
createFeedList.get;
this.feedList = feedList;
}]);
HTML:
<html ng-app="FeedReader">
<head>
<meta charset="UTF-8">
<title>Reader Trial</title>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular-resource.js"></script>
</head>
<body ng-controller="blogCtrl">
<ul>
<li ng-repeat="list in feedList">{{list.title}}</li>
</ul>
<script src="./feedReader.js"></script>
</body>
</html>
Any ideas as to why I'm not getting my feedList array populated?/Getting no output
Edit - I have setup a fiddle for this http://jsfiddle.net/6L9K5/