Chapter 8. Promises

In this chapter, we will cover the following recipes:

  • Understanding and implementing a basic promise
  • Chaining promises and promise handlers
  • Implementing promise notifications
  • Implementing promise barriers with $q.all()
  • Creating promise wrappers with $q.when()
  • Using promises with $http
  • Using promises with $resource
  • Using promises with Restangular
  • Incorporating promises into native route resolves
  • Implementing nested ui-router resolves

Introduction

AngularJS promises are an odd and fascinating component of the framework. They are integral to a large number of core components, and yet many references only mention them in passing. They offer an extremely robust and advanced mechanism of application control, and as application complexity begins ...

Get AngularJS Web Application Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.