Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Component({
  2.   selector: 'app-test',
  3.   templateUrl: './test.component.html',
  4.   styleUrls: ['./test.component.scss']
  5. })
  6. export class TestComponent implements OnDestroy {
  7.   title = 'Hello World';
  8.   showHistory = true;
  9.  
  10.   be2 = new BehaviorSubject(1);
  11.  
  12.   constructor(private heroService: HeroService) {
  13.     this.heroService.mySubject.subscribe(v => console.log(v));
  14.     interval(1000).subscribe(val => console.log(val));
  15.   }
  16.  
  17.   toggle() {
  18.     this.showHistory = !this.showHistory;
  19.   }
  20.  
  21.   ngOnInit() {
  22.     this.be2.pipe(
  23.       map(v => v)
  24.     ).subscribe(v => console.log(v));
  25.   }
  26.  
  27.   ngOnDestroy() {
  28.     console.log('fooo');
  29.   }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement