Issue
Hey I have a modal I am using which is basically listening to an subject observable and the global http interceptor is pushing an error onto it
so this works great for the first error:
<modal
modalwidth="50"
open="true"
label="Oh no!"
*ngIf="errorMessage$ | async as errorMessage"
>
if on the same page though you cause another error this modal does not appear again, so you get the first error - modal appears, you close it - cause another error and the modal never appears.
http interceptor calls handleError->
private errorMessageSubject = new Subject<CustomError>();
public errorMessage$ = this.errorMessageSubject.asObservable();
handleError(error: HttpErrorResponse): void {
this.errorMessageSubject.next({
then on the root of the Angular app in the app.component.ts
this.errorMessage$ = this.errorService.errorMessage$;
I believe what I need to reset the observable somehow
Solution
After closing modal emit void
:
this.errorMessageSubject.next(void 0);
Answered By - Eugene
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.