2

We are using Angular JS promises heavily and its one of the recommend practice from Angular team also. I feel that its just a syntax sugar on the top of Callback. But not sure about it. Can anybody give me few examples where Angular.js promises are better than javascript callbaks?

2
  • I believe angular promise is better because if reduce burden of many callbacks. Same approach is in Nodejs instead of callback Modular or Promises approach is recommended. Commented Nov 4, 2015 at 9:04
  • 1
    12devs.co.uk/articles/… details why promises are superior to callbacks Commented Nov 4, 2015 at 9:05

2 Answers 2

3

Promises can be chained and avoid the 'pyramid of doom'. They also have a defined way of handling results like success and failures, which with callbacks is not the case.

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

Comments

0

if you have multiple ajax calls and on each success of those calls sometimes you have to call the same ajax method again. Coding such scenario becomes ugly with callbacks.

Promise handles that very elegantly.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.