I have seen this: https://stackoverflow.com/a/38038733/806963 but I cant find a way to add params from the navigateByUrl method or a way to acomplish any of that in Angular2 final.
I have 2 router-outlers in 2 diffrent components.
<router-outlet></router-outlet>
inside AppModule.<router-outlet name="account-information-outlet"></router-outlet>
inside AccountModule.
My code:
export const appRouting = RouterModule.forRoot(
[
{
path: 'shop',
loadChildren: 'app/modules/shop.module#ShopModule'(is not imporntent right now)
},
{
path: 'account',
loadChildren: 'app/modules/account.module#AccountModule' (related to the code below)
},
{
path: '',
redirectTo: 'shop',
pathMatch: 'full'
},
]);
export const accountRouting: ModuleWithProviders = RouterModule.forChild([
{
path: '',
component: AccountInformationComponent,
canActivate: [
IsAnyUserLoggedInGuard
],
children:[
{
path: 'profile/:key',
component: ProfileComponent,
outlet: "account-information-outlet"
}
]
}
]);
I tried to call this from AccountModule (AccountInformationComponent) : this.router.navigate(['account/profile', parameter)
but it failed.
Error:
Cannot match any routes: 'account/profile/-KUOW06DpH06D2rdvbLJ'