Questions tagged [candeactivate]
39 questions
0
votes
0 answers
Loop between canDeactivate and canActivate when trying to leave page
I have implemented a canDeactivate guard with the common 'can I leave page' dialogue. For the most part it works. I can leave a page if I confirm or stay if I cancel.
Here is the guard:
import { Injectable } from '@angular/core';
import {…

Lukindo Mbuli
- 115
- 9
0
votes
1 answer
How to trigger can-deactivate-guard when queryParams change?
I am using the following routing inside app-routing module:
path: "overview",
component: OverviewComponent,
children: [
{ path: 'edit', component: DetailComponent, canDeactivate: [CanDeactivateGuardService] }
]
My problem is that canDeactivate…

Richard Avalos
- 555
- 5
- 18
0
votes
1 answer
Angular 9, How to return the value to canDeactivate from NgbModal return value
Thank you for helping beforehand.
Im trying to use canDeactivate function with NgbModal.
Which means, I want to return the value depends on NgbModal's return.
I already saw its working with comfirm alert, but Its not working as I wanted with…

pearllv
- 238
- 1
- 2
- 10
0
votes
1 answer
angular 9 candeactivate not working although code seems to be fine and not throwing any error
Hello Guys I am new to Angular and learning the things using the following tutorial link. For some reason the canDeactivate route guard seem to not work. Any help would be appreciated as I tried checking many things but none worked. I have the…

BATMAN_2008
- 2,788
- 3
- 31
- 98
0
votes
1 answer
CanDeactivateGuard doesn't work with confirmation subscription
I need to create canDeactiovateGuard to prevent user losing form data when trying to leave form page.
This code below doesn't work since return canDeactivate works before canDeactivate = confirmed. I'm not sure how to fix this.…

Olga
- 119
- 1
- 1
- 12
0
votes
1 answer
CanDeactivate guards does not runs as expected, after pressing browser back button
I have implemented canDeactive guard, once browser button is clicked it popups a Model and ask Yes/No.
After clicking on No it stays on the same page and Again if i press the back button the popup appears and after clicking No/Yes button it…

Rohit Vaidya
- 3
- 4
0
votes
1 answer
Angular8 RXJS CanDeactivate wait for result of observable before deactivation
I am attempting to use a CanDeactivate guard to detect when a user navigates away from the component. The purpose is to #1 check if the current user owns the 'Is Being Edited' lock on the record, and #2 if so, call an observable to update the…

pengz
- 2,279
- 3
- 48
- 91
0
votes
1 answer
Router Guards in Angular 8
I created an application where the user inputs data. On that application, I want to implement router guards to deny the user to go back on-page so that they don't lose their data. If the user clicks on the back button on the browser, it reloads page…

Shank
- 413
- 4
- 15
0
votes
2 answers
Angular canDeactivate not working and value showing null
I am following link from : https://www.concretepage.com/angular-2/angular-candeactivate-guard-example and nothing is working for me in my real world application. I have below code.
AppModule
@NgModule({
declarations: [
AppComponent,
…

PAA
- 1
- 46
- 174
- 282