# Show Routes with Outlets The `RouterOutlet` directive is a placeholder where Angular renders the component for the current URL. ## Basic Usage Include `` in your template. Angular inserts the routed component as a sibling immediately following the outlet. ```html ``` ## Nested Outlets Child routes require their own `` within the parent component's template. ```ts // Parent component template

Settings

``` ## Named Outlets (Secondary Routes) Pages can have multiple outlets. Assign a `name` to an outlet to target it specifically. The default name is `'primary'`. ```html ``` Define the `outlet` in the route config: ```ts { path: 'chat', component: Chat, outlet: 'sidebar' } ``` ## Outlet Lifecycle Events `RouterOutlet` emits events when components are changed: - `activate`: New component instantiated. - `deactivate`: Component destroyed. - `attach` / `detach`: Used with `RouteReuseStrategy`. ```html ``` ## Passing Data via `routerOutletData` You can pass contextual data to the routed component using the `routerOutletData` input. The component accesses this via the `ROUTER_OUTLET_DATA` injection token as a signal. ```ts // In Parent // In Routed Component outletData = inject(ROUTER_OUTLET_DATA) as Signal<{ theme: string }>; ```