Angular adds success() and error() convenience methods to promises returned by $http but they don't work the same as then().

Versions used below

"angular": "1.3.14"

Chaining off of then()


Once fn1 has signaled it is done, fn2 will run. Nothing new here, this is just promises chaining like you'd expect.

One thing to note is the response object is passed to fulfill handlers and reject handlers. This does not follow the convention of passing an Error to reject handlers.

success() after then()

This fails because the promise returned by then() is a plain old $q promise. It doesn't have the http-specific success() and error() helpers.

.success(fn2) // TypeError: undefined is not a function

Chaining off of success() and error()

Taking a peek at the code, we see that success() and error() return the original http promise and not the promise generated by your callback. The callback's return value is ignored.

Chaining off of success() is possible but it does not work like chaining off of then().


fn2 will not wait for fn1 and they're essentially run in parallel.

What do success() and error() provide?

The success() and error() methods pass properties of the response object to their callback.

// using success() or error()
.success(function(data, status, headers, config) {


// using then()
.then(function(response) {
// response.status
// response.headers
// response.config

You save a little typing and use slightly less generic names but I'm not sure it's worth the potential confusion.