ng-destroy-subscriptions
v1.0.2
Published
When a component breaks down, all subscribers will be unsubscribed. \ This will not interfere with ngOnDestroy
Downloads
2
Maintainers
Readme
When a component breaks down, all subscribers will be unsubscribed.
This will not interfere with ngOnDestroy
import {DestroySubscriptions, IDestroySubscriptions} from 'ng-destroy-subscriptions';
@Component({
selector: 'app-orders-history',
templateUrl: './orders-history.component.html',
styleUrls: ['./orders-history.component.scss'],
})
@DestroySubscriptions
export class OrdersHistoryComponent implements OnInit, IDestroySubscriptions {
subscriptions: Subscription[] = [];
constructor(private exampleService: ExampleService) {
}
ngOnInit() {
this.subscriptions.push(this.exampleService.orders.subscribe((orders) => {
// do whatever you want
}));
}
}
Issues: [email protected]