Skip to content

Instantly share code, notes, and snippets.

@PrashantSinghGour
Created August 17, 2023 10:53
Show Gist options
  • Select an option

  • Save PrashantSinghGour/c78222564faa91a063a907c440fa11a9 to your computer and use it in GitHub Desktop.

Select an option

Save PrashantSinghGour/c78222564faa91a063a907c440fa11a9 to your computer and use it in GitHub Desktop.
master subscription
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