我的对话路由.module.ts:
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ConversationComponent } from './conversation.component';
import { ConversationDetailComponent } from './conversation-detail/conversation-detail.component';
const routes: Routes = [
{
path: '',
component: ConversationComponent,
children: [
{
path: 'detail',
component: ConversationDetailComponent
},
{
path: 'detail/:conversation_id',
component: ConversationDetailComponent
},
{
path: 'add-conversation',
component: ConversationDetailComponent,
data: {
addNew: true
}
},
{
path: '',
redirectTo: 'detail'
}
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ConversationRoutingModule { }
并在带有路由器“对话/添加对话”的session-detail.component.ts中:
this.router.navigate(['../detail'], {relativeTo: this.route});
它只是导航到根默认路由器,控制台日志什么也没有。
我正在使用angular 6.0.0和延迟模块加载。