All topics
Routingadvanced

Auxiliary Routes

Explain named/auxiliary router outlets and how they let multiple independent views be active at once.

A normal <router-outlet> (the primary, unnamed outlet) can only show one route's component at a time, but some UIs genuinely need multiple, independently navigable regions active simultaneously — a chat panel that can open alongside whatever main content is showing, or a details drawer that slides in without replacing the main view underneath it. Auxiliary (named) outlets are Angular's answer: additional <router-outlet name="..."> elements that the router can target independently of the primary outlet.

It's like a split-screen television that can tune two channels at once, each independently changeable with its own remote, rather than one screen where changing the channel always replaces whatever was showing before.

Key Concepts

1
A route targeting a named outlet declares outlet: 'chat' (matching the outlet's name attribute) in its configuration, and navigating to it uses a distinct URL syntax with parentheses — something like /inbox(chat:conversation/42) — where the primary route and the auxiliary route's state are both represented in the same URL simultaneously, each independently bookmarkable and independently navigable via router.navigate()'s array-based outlets syntax.
outlet: 'chat'name/inbox(chat:conversation/42)router.navigate()
2
Interviewers ask about this specifically because it's one of the more obscure corners of the Router that experienced Angular developers have often heard of but rarely used directly — correctly explaining the parenthesized URL syntax and the outlets: { chat: [...] } navigation extras object is a good signal of genuinely broad Router knowledge, not just the common guard/resolver/lazy-loading trio.
outlets: { chat: [...] }
3
A pragmatic answer also notes that auxiliary routes are a relatively niche tool — many UIs that seem to need "two things visible at once" are actually better served by simple component state (a boolean toggling a drawer's visibility) rather than encoding that state into the URL via a named outlet, and auxiliary routes earn their complexity specifically when that secondary view's state genuinely needs to be its own bookmarkable, independently-navigable piece of application state.