Created
June 24, 2022 07:53
-
-
Save NetanelBasal/cc851d3088456767f30eeeb67a140360 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { ActivatedRouteSnapshot, createUrlTreeFromSnapshot } from '@angular/router'; | |
@Injectable({ providedIn: 'root' }) | |
export class MyGuard implements CanActivate { | |
canActivate(route: ActivatedRouteSnapshot) { | |
if(checkData(route)) { | |
return createUrlTreeFromSnapshot(route, ['../sibling']); | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment