Controller.js:
service.getUsers(params).$promise.then(function(response) {
var data = response;
$scope.users = data.resources;
$scope.totalItems = data.totalResults;
});
Service.js:
return $resource('/Users', {}, {
getUsers: {
method: 'GET',
headers: {'segment' : 'computedSegment'},
isArray: true,
transformResponse: function(data, header){
var wrapped = angular.fromJson(data);
angular.forEach(wrapped.resources, function(item, idx) {
wrapped.resources[idx] = item;
});
var deffered = $q.defer();
deffered.resolve(wrapped);
return deffered.promise;
}
}});
The issue i am getting, is that although the request goes to the server, i receive a response, the data is correctly processed, the ,,then" function will never be executed to set the $scope variables.
Does anyone have an idea?