Making Angular Service - Always Singleton

added by DotNetKicks
8/10/2022 4:35:57 PM

198 Views

By default, Angular Services are Singleton. When you create a service using the CLI command, ng g s App Angular creates a service named AppService. https://gist.github.com/debugmodedotnet/17b2ff1a9050ae4d9530fd75b99d99ce import { Injectable } from '@angular/core'; @Injectable({ providedIn: 'root' }) export class AppService { constructor() { } } The above service is SingletonTree-shakeableAvailable throughout the application Singleton means Angular...


0 comments