Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Angular Singleton Services

A Singleton Serviceis one which has only one instance shared across the entire Angular App, it is a great way to share data across different components even if they don’t have any Hierarchal relationship. Services can be declared Singleton by setting the providedIn property of the @Injectable() to "root", when creating the service.

@Injectable({
  providedIn: 'root',
})


This post first appeared on C# Guide, please read the originial post: here

Share the post

Angular Singleton Services

×

Subscribe to C# Guide

Get updates delivered right to your inbox!

Thank you for your subscription

×