//in a PService module
this.fetchTypes = function(){
var types = PTypesFactory.retrieve({});
return types.$promise.then(function(result)
{
console.log(result.groups);
return result.groups;
});
}
//inside a controller
$scope.groupsData = PService.fetchTypes();
After correctly fetching the REST data and logging it with:
console.log($scope.groupsData);
I am getting:
Object {then: function, catch: function, finally: function}
This actually returns the Promise API instead of the resolved data.