모달 창에 보조 경로를 사용하려고합니다. 내가 시도한 것에 관계없이 해결할 수는 없습니다. 방금 라우팅 오류가 발생합니다. 여기 내 접근 ...각도 2 라우터가 하위 보조 경로를 해결하지 않습니다.
app.component.html
<router-outlet></router-outlet>
<router-outlet name="modal"></router-outlet>
관리 - routing.module.ts
...
const ROUTES: Routes = [
{
path: 'admin',
component: AdminComponent,
children: [
{
path: 'accounts',
loadChildren: './accounts/accounts.module#AccountsModule'
},{...}
]
}
];
...
계정-routing.module.ts입니다
...
const ROUTES: Routes = [
{
path: '',
children: [
{
path: '',
component: AccountsIndexComponent
},{
path: 'new',
component: AccountsNewComponent
},{
path: ':id',
component: AccountsShowComponent
},{
path: ':id/edit',
component: AccountsEditComponent,
outlet: 'modal'
}
]
}
];
...
modal.service.ts
...
constructor(
private router:Router,
private route:ActivatedRoute
) { }
open(route:Array<any>) {
this.router.navigate(
[{outlets: {drawer: route}}], {relativeTo: this.route}
)
}
...
나는 그것이 내가 그것을 어떻게 해야하는 생각 무엇 /admin/accounts(modal:1/edit)
로 이동하려고 ModalService.open([account.id, 'edit'])
전화. 하지만 난 그냥 1/edit
URL 세그먼트와 일치하지 않는 오류가 발생합니다.
NavigationError(id: 2, url: '/admin/accounts(modal:1/edit)', error: Error: Cannot match any routes. URL Segment: '1/edit')
나는 다음을 시도하고 그들은 ... 중 하나가 작동하지 않았다
ModalService.open(['accounts', account.id, 'edit'])
ModalService.open(['admin','accounts', account.id, 'edit'])
정확히 동일한 문제가 발생합니다. 해결책을 찾았습니까? –
절대로하지 않았습니다. 우리는 포기하고 ng-bootstrap 라이브러리 – Brian