2

I want to ask about the difference about this method My concern is difference between .then and .success, function and also .error thanks.

// Simple GET request example:
$http({
   method: 'GET',
   url: '/someUrl'
}).then(function successCallback(response) {
   // this callback will be called asynchronously
   // when the response is available
}, function errorCallback(response) {
   // called asynchronously if an error occurs
   // or server returns response with an error status.
});

and

// Simple GET request example:
$http({
   method: 'GET',
   url: '/someUrl'
}).success(function successCallback(response) {
   // this callback will be called asynchronously
   // when the response is available
}).error( function(data) {
   // called asynchronously if an error occurs
   // or server returns response with an error status.
});
7

1 Answer 1

6

Both .then() and .sucess() are refer to promise it run asynchronously and wait for the response if it fullfied your request then resolve it otherwise reject it.

.success and .error are deprecated you can find more details on documentation

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.