December 2017
Beginner
372 pages
10h 32m
English
Angular provides a neat way to register our services in an application using the built-in injector. The Angular injector creates an instance of our service and holds on to that single instance, providing us with a singleton behavior. It acts as a container for all the services registered with Angular. The following diagram shows an example of the injector managing multiple services, with each service having a single instance:

The advantage of the injector maintaining the service instance is two-fold. First, it takes away our responsibility of managing instances, which Angular will now do. Secondly, having a single instance ...
Read now
Unlock full access