1.0.2 • Published 5 years ago

ng-destroy-subscriptions v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

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: antonantion@mail.ru