Promises in AngularJS

Hi, for the beginning I start with the most important thing in working with AngularJS. This is Promises.

So, what is the Promises? This is a service that helps you run functions asynchronously, and use their return values (or exceptions) when they are done processing. For example in real life. I went to Angel in us coffee and ordered my favorite Mocha, they give me an electric card and wait for them. Whenever the electric card is vibrated my favorite Mocha finished. :)

Now let’s see Promises in action:

I have a service that communicated with server-side.

And then, in the controller I call it. The response from the ‘Coffee API’ will be returned with the promise, if it was fulfilled. It will be in the format: {“status”: “done”}

That’s all, If you have any question, please comment below! I will answer asap :)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.