Janciu
Janciu

Reputation: 115

Which component renders child component if parent is componentless

Which component is used to display children components if the parent path does not have any component like in the example below (which component will render ScheduleListComponent component).

const routes: Routes = [
  {
    path: '',  
    children: [
      { path: '', component: ScheduleListComponent },
      { path: 'function/:id', component: ScheduleFunctionComponent },
      { path: 'schedules/:id', component: ScheduleComponent },
    ]
  }
];

Upvotes: 0

Views: 54

Answers (1)

Chellappan வ
Chellappan வ

Reputation: 27471

Since there is no component assosiated with It wil be rendered in parent router-outlet, normally this pattern is called component less routes.

Componentless routes “consume” URL segments without instantiating components.

Now, when navigating to ’/function/1’, the router will create the following component tree:

AppComponent -> ScheduleFunctionComponent

For more information

Upvotes: 1

Related Questions