Asynchronous Data Handling in AngularJs
Asynchronous is great in terms of performance, resource utilization and system throughput. Handling control flow is really painful. In Jquery and AngularJs we have promises to handle asynchronous requests. A promise represents the eventual result of an operation. You can use a promise to specify what to do when an operation eventually succeeds or fails. Promises in AngularJS are provided by the built-in $q service. How it looks in Client-side: $http is one of the service that returns promise which contains the response. var promise = $http . get ( "/api/my/name" ); promise . success ( function ( name ) { console . log ( "Your name is: " + name ); }); promise . error ( function ( response , status ) { console . log ( "The request failed with response " + response + " and status code " + status ); }); How it looks in Server-side: Promises in AngularJS are provided by th