Simplest way to share data between two unrelated Components in Angular | Infragistics Blog

PHOTO EMBED

Fri Sep 22 2023 05:54:04 GMT+0000 (Coordinated Universal Time)

Saved by @dayalalok #angular

export class Appchild2Component implements OnInit {
 
    count: number;
    constructor(private appsevice: AppService) {
    }
    ngOnInit() {
 
        this.appsevice.count.subscribe(c => {
            this.count = c;
        });
    }
    nextCount() {
        this.appsevice.nextCount();
    }
}
content_copyCOPY

Unrelated Component Communications

https://www.infragistics.com/community/blogs/b/infragistics/posts/simplest-way-to-share-data-between-two-unrelated-components-in-angular