@angular/router#PRIMARY_OUTLET TypeScript Examples
The following examples show how to use
@angular/router#PRIMARY_OUTLET.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: auth.guard.ts From barista with Apache License 2.0 | 6 votes |
checkLogin(url: string, isAdminRoute: boolean): boolean {
if (AuthService.isLoggedIn) {
if (isAdminRoute && !this.authService.isAdmin) {
this.router.navigate(['/projects/user']);
return false;
}
return true;
}
// Store the attempted URL for redirecting
const tree = this.router.parseUrl(url);
const primary: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];
this.authService.redirectUrl = primary.toString();
this.authService.redirictParams = tree.queryParams;
// Navigate to the login page with extras
this.authService.logout();
return false;
}
Example #2
Source File: shell.service.ts From scion-microfrontend-platform with Eclipse Public License 2.0 | 6 votes |
public isDetailsOutletActive$(): Observable<boolean> {
return this._router.events
.pipe(
filter(event => event instanceof NavigationEnd),
map((event: NavigationEnd) => {
const urlTree = this._router.parseUrl(event.urlAfterRedirects);
return urlTree.root.children[PRIMARY_OUTLET]?.children['details'] !== undefined;
}),
);
}