6 Services

This chapter covers

  • Services and their role
  • Creating many different types of services
  • Using services to help retrieve and manage data
  • Replacing logic from controllers with services
  • Understanding how dependency injection works with services

In chapters 4-5, we had the Dashboard component, which generated some data for the rest of the application to consume. But that was only because we didn’t want to introduce more complexity into the example. This isn’t ideal in most scenarios, because that logic is hard to reuse and makes the component unnecessarily complex.

Your application will need to manage many tasks, and many of them will fall outside of the responsibility of components, such as managing data access, managing configuration ...

Get Angular in Action now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.