I have seen answers on StackOverflow where people suggest furnishing a callback function to an AngularJS service.

```
app.controller('tokenCtrl', function($scope, tokenService) {
    tokenService.getTokens(function callbackFn(tokens) {
        $scope.tokens = tokens;
    });
});

app.factory('tokenService', function($http) {
    var getTokens = function(callbackFn) {
        $http.get('/api/tokens').then (function onFulfilled(response) {
            callbackFn(response.data);
        });
    };

    return {
        getTokens: getTokens
    };
});

```

This seems to me to be an Anti-Pattern. The `$http` service returns promises and having `.then` methods execute callback functions feels like an unhealthy inversion of control.

How does one **re-factor** code like this and how does one explain why the original way was **not a good idea?**