I have a setting with a service to retrieve a list of items, a controller to do something on this list, and a view to repeat and display each item.
The fact is that my elements are associated with RSS feeds and the controller. I want to parse these RSS feeds and configure the model data for viewing.
Now there are a few more changes in the simulation that need to be done (I need to simulate the actual content of the RSS feed), but my first problem is that the data received by the service does not change in my controller (since the call did not end, at that time when I try to access it, I think). Basically this is just an empty array if I write it to the console.
Therefore, I will need to know how to start data operations in the controller after the service call is completed.
Thanks!! // Joakim
Service Code:
angular.module('itemfeedServices', ['ngResource']). factory('Item', function($resource){ return $resource('items/:itemId.json', {}, { query: {method:'GET', params:{itemId:'items'}, isArray:true} }); });
Controller Code:
function ItemListCtrl($scope, Item) { $scope.items = Item.query(); console.log($scope.items);
source share