5

Angular Services and the Singleton Pattern

One of the great differences between a static web page and a single-page application is the processing capacity and interaction in the user’s browser, giving the feeling of an application installed on the device. In the Angular framework, the elements for this processing and interaction, not only with the backend but with the user, are the services.

This element is so important to Angular that the team created a dependency management system, which allows a simplified way of creating, composing, and using services in components.

In this chapter, we will explore this element and learn about the design patterns it uses and the best practices to use in your project.

Here we will cover the following topics: ...

Get Angular Design Patterns and Best Practices 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.