Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. @Component({
  2. selector: 'another-component',
  3. templateUrl: 'another.template.html',
  4. })
  5. export class AnotherComponent implements OnInit {
  6. data;
  7.  
  8. constructor(
  9. private eventQueue: EventQueueService,
  10. private dataService: DataService,
  11. ) {}
  12.  
  13. ngOnInit() {
  14. this.eventQueue.on(AppEventType.AccountChanged)
  15. .pipe(
  16. switchMap(() => this.dataService.getData()),
  17. )
  18. .subscribe(res => this.handleEvent(res));
  19. }
  20.  
  21. handleEvent(res) {
  22. // Do something with the response
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement