Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
import { Observable } from 'rxjs/Observable';
import {
CanDeactivate,
ActivatedRouteSnapshot,
RouterStateSnapshot
} from '@angular/router';
export interface CanComponentDeactivate {
canDeactivate: () => Observable<boolean> | boolean;
}
export class CanDeactivateGuard
implements CanDeactivate<CanComponentDeactivate> {
inactive = false;
canLogout = true;
canDeactivate(
component: CanComponentDeactivate,
currentRoute: ActivatedRouteSnapshot,
currentState: RouterStateSnapshot,
nextState?: RouterStateSnapshot
): Observable<boolean> | boolean {
if (this.inactive) {
return true;
}
return component.canDeactivate();
}
setInactive() {
this.inactive = true;
}
setActive() {
this.inactive = false;
}
getCanLogout() {
return this.canLogout;
}
setCanLogout(bool) {
this.canLogout = bool;
}
}