I\'m trying to use the routerCanDeactivate function for a component in my app. The simple way to use it is as follows:
routerCanDeactivate
routerCanDeactivate() {
Can also be done out of the box in the Angular2+ world using Subjects:
export class MyComponent { private subject: Subject; routerCanDeactivate(): PromiseLike { $('#modal').modal('show'); return this.subject.toPromise(); } handleRespone(res: boolean) { this.subject.next(res); } }