Мой маршрут корневого модуля выглядит так:
http://localhost:4200/#/booking/flightBooking/list
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FlightBookingListComponent } from './flight-booking-list.component';
import { ItineraryBookingDetailModule } from '../../itinerary/booking-detail/itinerary-booking-detail.module';
import { LazyloadModalComponent } from 'app/shared/lazyload-modal/lazyload-modal.component';
const routes: Routes = [
{
path: '', component: FlightBookingListComponent,
children: [
{
path: 'itinerary',
outlet: 'modal',
component: LazyloadModalComponent,
children: [
{path: '', loadChildren: '../../itinerary/booking-detail/itinerary-booking-detail.module#ItineraryBookingDetailModule'}
]
}
]
},
{
path: 'itinerary',
outlet: 'modal',
component: LazyloadModalComponent,
children: [
{path: '', loadChildren: '../../itinerary/booking-detail/itinerary-booking-detail.module#ItineraryBookingDetailModule'}
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class FlightBookingListRoutingModule { }
HTML-код
...list
<div><router-outlet name="modal"></router-outlet></div>
component.ts
onClickDetail(rowItem: any): void {
console.log(this.router)
console.log(this.activatedRoute)
console.log(rowItem)
console.log(ITEM.CATEGORY_CODE.FLIGHT)
// this.router.navigate(['itinerary', {
// categotyCode: ITEM.CATEGORY_CODE.FLIGHT,
// bookingCode: rowItem.bookingItemCode
// }])
this.router.navigate(
['', {outlets: {modal: ['itinerary']}}],
// {
// relativeTo: this.activatedRoute
// }
);
// this.router.navigate([{ outlets: { modal: ['itinerary'] } }]);
// this.router.navigate([{ outlets: {
// modal: ['itinerary']
// }}]);
}
ошибка img
NavigationError {id: 2, url: "/ booking / flightBooking / list (модальный: маршрут)"
Невозможно сопоставить ни один маршрут. Сегмент URL: «маршрут»