Created
October 12, 2020 07:31
-
-
Save LironHazan/cee022a46fc9e15aea278421acf32a29 to your computer and use it in GitHub Desktop.
Assaf Azulai's example for rxjs post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interactionSubject = new Subject<void>(); | |
ngOnInit() { | |
this.interactionSubject.asObservable().pipe( | |
switchMap((data) => { | |
this.server.fetchData(data).pipe( | |
catchError((err) => { | |
// handle error | |
}) | |
) | |
}) | |
).subscribe(dataFromServer => { | |
// Do something | |
}); | |
} | |
interaction1() { | |
this.interactionSubject.next(); | |
} | |
interaction2() { | |
this.interactionSubject.next(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment