September 2017
Intermediate to advanced
450 pages
11h 24m
English
Services are registered as providers at the module level of your application. When we register a service with Angular, it's automatically injected into our module via dependency injection when the service is marked with the @Injectable decorator. After injection, any component or module of our application has access to our shared service through its constructor.
constructor(private injectedService: ServiceName) {}
By setting a value of the service in our AppModule, we can retrieve the same value from the service in our CreatePostFormComponent. This is because the service is effectively a singleton class that is dependency injected into the different parts of our application. This provides a great method of sharing state across ...
Read now
Unlock full access