I have a confirm/cancel modal dialog that pops up when a user leaves a route. I do this by using a guard with the canDeactivate method. However I want canDeactivate to wait
It was not working on my end because I was using BehaviorSubject with initial value null.
BehaviorSubject
null
Make sure to create Observable from Subject like:
Subject
private modalConfirmation = new Subject(); public getModalSelectionObservable(): Observable { return this.modalConfirmation.asObservable(); }