Implement canactivatechild also
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
parent
24eef611d4
commit
62887e8089
@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CanLoad, Route, CanActivate, CanDeactivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
|
import { CanActivate, CanActivateChild, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
|
||||||
|
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
@ -10,13 +10,21 @@ import * as appCommonActions from '../actions/app-common.actions';
|
|||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class FullScreenGuard implements CanActivate {
|
export class FullScreenGuard implements CanActivate,CanActivateChild {
|
||||||
|
|
||||||
private loginDispatched = false;
|
private loginDispatched = false;
|
||||||
constructor(private store: Store<appCommonReducer.State> ) { }
|
constructor(private store: Store<appCommonReducer.State> ) { }
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
setFullScreen():boolean {
|
||||||
this.store.dispatch(new appCommonActions.FullScreen());
|
this.store.dispatch(new appCommonActions.FullScreen());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||||
|
return this.setFullScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||||
|
return this.setFullScreen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,16 @@ export class NavBarGuard implements CanActivate {
|
|||||||
private loginDispatched = false;
|
private loginDispatched = false;
|
||||||
constructor(private store: Store<appCommonReducer.State>) { }
|
constructor(private store: Store<appCommonReducer.State>) { }
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
setNavBar():boolean {
|
||||||
this.store.dispatch(new appCommonActions.ShowNavBar());
|
this.store.dispatch(new appCommonActions.ShowNavBar());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||||
|
return this.setNavBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||||
|
return this.setNavBar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user