I try to read two rss feed and i have an error.
This is my ctrl and the factory :
app.factory('FeedService', ['$http', function($http){
return {
parseFeed : function(url) {
return $http.jsonp('https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=50&callback=JSON_CALLBACK&q=' + encodeURIComponent(url));
}
}
}]);
app.controller('ActuCtrl', ['$scope', '$rootScope', 'FeedService', function($scope, $rootScope, Feed1, Feed2) {
Feed1.parseFeed("https://www.facebook.com/feeds/page.php?id=618857251494402&format=rss20").then(function(res){
$scope.feeds1=res.data.responseData.feed.entries;
$scope.quantity1 = 5;
});
Feed2.parseFeed("https://www.facebook.com/feeds/page.php?id=149375131740957&format=rss20").then(function(res){
$scope.feeds2=res.data.responseData.feed.entries;
$scope.quantity2 = 5;
});
}]);
my html :
<ul>
<li ng-repeat="feed in feeds1 | filter:cleanit | limitTo:quantity1">
<p><a href="{{feed.link}}">{{feed.title}}</a></p>
</li>
</ul>
<ul>
<li ng-repeat="feed2 in feeds2 | filter:cleanit | limitTo:quantity2">
<p><a href="{{feed.link}}">{{feed.title}}</a></p>
</li>
</ul>
and the error:
TypeError: Cannot read property 'parseFeed' of undefined at new (ActuCtrl.js:16:14)
What's wrong ?
Feed2? It will be undefined anyways you are not specifying the dependency for thatfeed1will beFeedServiceinstance, see the dependencies