Hey everyone, I could really use some advice regarding an issue I'm facing with my factory and controller.
Currently, I have a factory that retrieves data from the server:
sp.factory('homeFeed',['$window','$http','auth',function($window,$http,auth){ var url = auth.url; var version = auth.version; var HomeFeed = {}; HomeFeed.getFeeds = function(user){ //setting up variables for GET request on home feed var req = { method: 'GET', url: url + version + '/Feed', headers: { 'Content-Type': 'application/json; charset=utf-8', 'Authorization': 'Bearer ' + token }, } return $http(req).success(function(res){ return res; }); }; return HomeFeed; }]);
Here's my controller:
sp.controller('HomeCtrl',['$scope','homeFeed','$window',function($scope,homeFeed,$window){ //retrieving all the home feed data $scope.feeds = homeFeed.getFeeds(JSON.parse($window.localStorage['SP-User'])) }]);
However, once I get the response from the server, my view doesn't update and the $scope.feeds remain unchanged. Any help would be greatly appreciated!