'Make a component render in more than one page - Routes Angular 13
I have the following routes, and I need to render the Conditional component in some specific routes, but the shared component in all routes. How can I do it?
const routes: Routes = [
{
path: "someroute", component: ConditionalComponent,
children: [{ path: '', component: SharedComponent }],
} ];
Solution 1:[1]
If I understand the question correctly, you should be able to have
const routes: Routes = [
{
path: "someroute",
component: ConditionalComponent
}
];
And in your app.component.html you should have
<router-outlet></router-outlet>
<shared-component></shared-component>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TSiders |
