Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Created June 24, 2022 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NetanelBasal/cc851d3088456767f30eeeb67a140360 to your computer and use it in GitHub Desktop.
Save NetanelBasal/cc851d3088456767f30eeeb67a140360 to your computer and use it in GitHub Desktop.
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