My Project Dashboard contains 2 sub apps.
├───projects
│ ├───app1
│ │ ├───e2e
│ │ │ └───src
│ │ └───src
│ │ ├───app
│ │ │ ├───form
│ │ │ ├───home
│ │ │ └───page-not-found
│ │ ├───assets
│ │ └───environments
│ ├───app2
│ │ ├───e2e
│ │ │ └───src
│ │ └───src
│ │ ├───app
│ │ │ ├───core
│ │ │ ├───home
│ │ │ ├───mail-view
│ │ │ ├───mailbox
│ │ │ ├───models
│ │ │ ├───page-not-found
│ │ │ └───service
│ │ ├───assets
│ │ └───environments
│ └───app3
│ ├───e2e
│ │ └───src
│ └───src
│ ├───app
│ ├───assets
│ └───environments
├───resources
└───src
├───app
│ ├───components
│ │ ├───navigation
│ │ └───progressbar
│ ├───core
│ │ ├───authentication
│ │ └───service
│ ├───dashboard
│ │ ├───models
│ │ ├───service
│ │ └───widget
│ ├───login
│ └───shared
│ ├───common
│ │ ├───config
│ │ └───service
│ └───core
├───assets
└───environments
Navigation works fine from dashboard-app to app1 and app2.
Within app2, mail-view and mailbox are child components of the home component.
const routes: Routes = [
{ path: 'mail', redirectTo: 'mail/home', pathMatch: 'full' },
{ path: 'mail/home', pathMatch: 'full', component: HomeComponent,
children: [
{ path: '', pathMatch: 'full', component: LoaderComponent },
{ path: 'mailbox/:type', component: MailboxComponent , resolve: { response: MailboxResolverService }},
{ path: 'mailbox/BLK/list/:header', pathMatch: 'full', component: BulkMailListComponent },
{ path: 'viewMail/:type/:mailId', pathMatch: 'full', component: MailViewComponent }
]
/*canActivate: [AuthGuard]*/ },
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
However, I encounter an 'Path not Found' error when trying to navigate to any of the child components.
this.route.navigate(['./mailbox/', AppConstants.MAILBOX_TYPE.INBOX_I], {relativeTo: this.aRoute});
custom-error-handler.service.ts:25 Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'mail/home/mailbox/INBI'
Error: Cannot match any routes. URL Segment: 'mail/home/mailbox/INBI'
at ApplyRedirects.push../node_modules/@angular/router/fesm5/router.js.ApplyRedirects.noMatchError (router.js:2459)
at CatchSubscriber.selector (router.js:2440)
- Is there a specific way to declare children when using sub modules?
- Or should navigation be done differently?
Thank you in advance.