Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 29x 29x 29x 7x 7x 7x | import { inject } from '@angular/core';
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
/**
* Redirects the user to the parent page if the requested page is the starting page (first page the user requested)
*/
export function redirectFirstToParentGuard(_: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean | UrlTree {
const router = inject(Router);
Iif (!router.navigated) {
return router.parseUrl(state.url.replace(/\/\w+$/, ''));
}
return true;
}
|