So I have a controller and service pair that are functioning properly right now, but my boss wants me to move the success/error/finally blocks from the controller to the service.
Controller Function:
            $scope.createUserButton = function () {
                $scope.isBusy = true;
                creationService.makeNewUser($scope.form)
                .success(function (data) {
                    var user = JSON.parse(data);
                    if (typeof user !== 'undefined') {
                        $scope.testusers.push(user);
                    }
                }).error(function () {
                    notify({
                        message: 'Could not create user',
                        classes: 'alert-danger',
                        templateUrl: 'partials/settingNotification.html'
                    });
                }).finally(function () {
                    $scope.isBusy = false;
                });
            };
Service:
service('creationService', ['restfulRepo', '$http',
function (restfulRepo, $http) {
this.makeNewUser = function (tempuser) {
    return $http({
        url: 'http://localhost:60098/***/*************/******',
        data: tempuser, method: 'PUT'
    });
};
}]);
The problem that I'm having is that if I move the success or finally blocks to the service, then they don't have access to the isBusy flag or to the testusers array. The array is bound to a graph in the controller that displays the information handed back.
 
     
     
     
    