Singelton service

Published on August 19, 2019

← Back to tips

Use the providedIn attribute of @Injectable() decorator to make your service tree-shakable [Angular 6+].

We can specify the module for which the service needs to be injected for. Handy to create singletons.