I frequently see tutorials and snippets online about Angular services to make $http calls that return both the $http promise and some data. If the promise is returned to the controller, what is the point of returning the data in the service? I don't even understand to where it is returned. Here's an example of what I mean:
 // Function of MyStuffService:
 function getStuff() {
    return $http.get('/api/stuff')
        .success(function(data) {
            // Why return data here? How could I even get this returned value?
            return data;
        })
        .error(function(data) {
            console.error(data);
        });
}
// Controller:
function getStuff() {
    MyStuffService.getStuff()
        .success(function(data) {
            $scope.stuff = data;
        })
}
Can't I just rewrite my service function as:
 // Function of MyStuffService:
 function getStuff() {
    return $http.get('/api/stuff')
        .error(function(data) {
            console.error(data);
        });
}
And let the controller get the data from the returned promise? I feel like I'm not understanding something here. Any help is greatly appreciated.
 
     
     
     
    