angular 4

1
A Deep Dive into Promises At this point, let’s quickly dive into the powerful concept that are promises. Promises in AngularJS are based on Kris Kowal’s Q proposal, which is a standardized, convenient way of dealing with asynchronous calls in JavaScript. The traditional way to deal with asynchronous calls in JavaScript has been with callbacks. Say we had to make three calls to the server, one after the other, to set up our application. With callbacks, the code might look something

Upload: samoasao

Post on 17-Nov-2015

213 views

Category:

Documents


0 download

DESCRIPTION

Promises

TRANSCRIPT

  • ADeepDiveintoPromisesAtthispoint,letsquicklydiveintothepowerfulconceptthatarepromises.PromisesinAngularJSarebasedonKrisKowalsQproposal,whichisastandardized,convenientwayofdealingwithasynchronouscallsinJavaScript.ThetraditionalwaytodealwithasynchronouscallsinJavaScripthasbeenwithcallbacks.Saywehadtomakethreecallstotheserver,oneaftertheother,tosetupourapplication.Withcallbacks,thecodemightlooksomething