Chapter 4. Dependency injection

This chapter covers

  • Introducing Dependency Injection (DI) as a design pattern
  • Benefits of DI
  • How Angular implements DI
  • Registering object providers and using injectors
  • The hierarchy of injectors
  • Applying DI in the online auction application

In the previous chapter, we discussed the router, and now your online auction application knows how to navigate from the Home view to an almost-empty Product Details view. In this chapter, you’ll continue working on the online auction, but this time we’ll concentrate on how to use Angular to automate the process of creating objects and assembling the application from its building blocks.

Any Angular application is a collection of components, directives, and classes ...

Get Angular 2 Development with TypeScript 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.