Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better to have similar API with angular $http on promise success function #2

Closed
antonheryanto opened this issue Jun 21, 2013 · 2 comments

Comments

@antonheryanto
Copy link

IMHO it better matching $http API as it easy to replace current $http provider with angular-servicestack

serviceStackRestClient.get('/api', success(function(response) { 
    r = response. data; 
});
// compare with
$http.get('/api').success(function(data, status, headers, config) { 
    r = data;
}); 

so we only to change injector when migrate code using this module

angular.module('app',['angular-servicestack'])
.controller('HttpController',['$scope', '$http', 
function($scope, $http) {
    $http.get('/api').success(function(data, status, headers, config) { 
        $scope.result = data;
    }); 
}])
//change the provider declaration without change function
.controller('ServiceStackController',['$scope', 'serviceStackRestClient',
function($scope, $http) {
    $http.get('/api').success(function(data, status, headers, config) { 
        $scope.result = data;
    }); 
}]}

so less code to migrate.
just my suggestion IMHO.

regard

@kkolstad
Copy link
Owner

I've gone back and forth on this one, mainly because I didn't want to clutter things up. But I think the ability to get at the headers and config will come up at some point. I'll add this in the next couple days.

@kkolstad
Copy link
Owner

Sorry for the delay. Changes made in 5d0fc01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants