1

In answer to this this question was said

you do not want to ever use success and error (prefer .then and .catch instead

and

$http returns a $q promise with the addition of the success and error handlers - however, these handlers do not chain and should generally be avoided if/when possible

and that success and error unwraps response object, but you can access status and such anyway so that doesn't seem relevant.

I also found this blogpost where author talks about confusion with other frameworks' ajax query commands and something about "You might not always know you're doing AJAX stuff.", which I don't fully understand.

So I'm little fuzzy on the reasoning behind "use then/catch instead of success/error". Is it mainly because of chaining errorcatching? Are the reasons outlined sufficient and I just don't get it? Is success/error fine in some situations? What are the considerations for the choice?

In all AngJS tutorials I've read and even answers here on stackowerflow I only saw success/error IIRC . . .

Community
  • 1
  • 1
Tev
  • 13
  • 1
  • 3

0 Answers0