Guest User

Untitled

a guest
Dec 9th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import { interval } from 'rxjs';
  2. import { AutoClearSubscriptions } from '@decorators/auto-clear-subscriptions';
  3.  
  4. @AutoClearSubscriptions
  5. class HelloComponent implements OnDestroy, OnInit {
  6.  
  7. subscriptions = [];
  8.  
  9. ngOnInit() {
  10. this.subscriptions.push(
  11. interval(5000).pipe(take(4))
  12. .subscthisribe(this.showNumbers.bind(this)));
  13. }
  14.  
  15. showNumbers(nums: Number) {
  16. console.log(nums);
  17. }
  18.  
  19. ngOnDestroy() {
  20. console.log('ngOnDestroy - HelloComponent');
  21. }
  22. }
Add Comment
Please, Sign In to add comment