-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(workbench/router): support navigation to children of the empty p…
…ath route Previously, views could not be navigated to child routes of the top-level empty path route. This limitation has now been removed, enabling the registration of route guards at a single place. ```ts { path: '', canActivate: [authGuard()], children: [ { path: 'view-1', loadComponent: () => import('./view/view-1.component'), }, { path: 'view-2', loadComponent: () => import('./view/view-2.component'), }, ] }, ``` closes #487
- Loading branch information
1 parent
a280af9
commit da578a9
Showing
8 changed files
with
127 additions
and
42 deletions.
There are no files selected for viewing
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
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
1 change: 1 addition & 0 deletions
1
projects/scion/workbench/src/lib/routing/empty-outlet/empty-outlet.component.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<router-outlet/> |
7 changes: 7 additions & 0 deletions
7
projects/scion/workbench/src/lib/routing/empty-outlet/empty-outlet.component.scss
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
:host { | ||
display: grid; | ||
|
||
> router-outlet { | ||
position: absolute; // out of document flow | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
projects/scion/workbench/src/lib/routing/empty-outlet/empty-outlet.component.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (c) 2018-2024 Swiss Federal Railways | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
import {Component} from '@angular/core'; | ||
import {RouterOutlet} from '@angular/router'; | ||
|
||
/** | ||
* Angular standardizes component-less auxiliary routes by adding the `ɵEmptyOutletComponent` component, | ||
* but only for routes registered via {@link ROUTES} DI token or passed to {@link Router#resetConfig}. | ||
* | ||
* Consequently, auxiliary routes that the workbench dynamically registers based on the current workbench | ||
* state must also be standardized. However, we do not use Angular's {@link ɵEmptyOutletComponent} component | ||
* as it does not fill the content to the available space, required for view content. | ||
* | ||
* For more information, see the `standardizeConfig` function in Angular. | ||
*/ | ||
@Component({ | ||
templateUrl: './empty-outlet.component.html', | ||
styleUrls: ['./empty-outlet.component.scss'], | ||
standalone: true, | ||
imports: [RouterOutlet], | ||
}) | ||
export class ɵEmptyOutletComponent { | ||
} |
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
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
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