What am I doing wrong with my Angular routing?
I have the following URL which works:
/marketplace/promotions
However, this gives me a 404:
/marketplace/promotions/create
app-routing.module:
export const routes: Routes = [
{
path: '',
component: HomeLayoutComponent,
children: [
{ path: 'marketplace', loadChildren: 'app/feature/marketplace/marketplace.module#MarketplaceModule' },
]
},
{ path: '**', component: NotFoundComponent },
marketplace.module
const routes: Routes = [
{
path: '',
children: [
{
path: '', redirectTo: 'promotions', pathMatch: "full"
},
{
path: 'promotions', component: PromotionHomeComponent, pathMatch: "full",
children: [
{
path: 'create', component: PromotionCreateComponent
}]
},
]
}
];
Update
I have tried removing pathmatch from the 'promotions' path, what happens is that I go to my PromotionHomeComponent component when trying to go to the /create url.
I don't have a routeroutlet in my PromotionHomeComponent. I was hoping it would use the main site header router outlet?
A 404 means that it redirects to my NotFoundComponent. I've updated my routing modules to show how that fits in.
There are no errors or messages in my console.
All this occurs via ng serve - all my other routes seem ok