Created
August 17, 2023 10:53
-
-
Save PrashantSinghGour/c78222564faa91a063a907c440fa11a9 to your computer and use it in GitHub Desktop.
master subscription
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable, OnDestroy } from '@angular/core'; | |
| import { Subscription } from 'rxjs'; | |
| @Injectable() // Adding the @Injectable decorator | |
| export class SubscriptionMaster implements OnDestroy { | |
| private subs: Subscription = new Subscription(); | |
| ngOnDestroy(): void { | |
| this.subs.unsubscribe(); | |
| } | |
| protected addSubscription(subscription: Subscription): void { | |
| this.subs.add(subscription); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment