Guide 11
Routing
cngxjs (opens in new tab)Updated Guide11of 13
Two kinds of routing meet here: the routes of your Angular app, which compodocx documents, and the navigation of the generated static site.
The routes page
compodocx reads your routes through the type checker and shows them onroutes.html, one indented tree per router and per unmounted route array. The page exists only when the project has routes. Turn it all off with--disableRoutes.
bootstrapApplication(AppComponent, {
providers: [provideRouter(routes, withComponentInputBinding())],
});- Routers. Each
provideRoutercall reached frombootstrapApplicationis one router. Named configs,mergeApplicationConfig, and spreads are followed. - Route arrays. Recognized by their
@angular/routertype, never by name. - Lazy routes.
loadChildrenarrays expand below their route, andloadComponenttargets link to the component. - Unmounted routes. An exported route array no router mounts, such as a library shipping feature routes, gets a section of its own.
RouterModule.forRoot, forChild, and stringloadChildren are not read.
Links back from your symbols
Component pages list the routes they render at, route arrays the places they are mounted at, and functional guards and resolvers the routes that use them, with the property (/account - canActivate). Feature pages show the routes of their members as a tree, and the command palette finds routes by their full path.
Navigating the generated site
The output is static HTML with real page URLs. A small client script intercepts internal links, fetches the page, swaps the content area, and updates the URL withhistory.pushState, so no framework runtime ships with your docs.
Tab activation by hash
Each entity tab has a stable hash id. Sharing a URL like #api opens the API tab, a member anchor opens the tab holding it, and #L42 scrolls the Source tab to that line. Tab panels win over headings with the same id, and hash updates usehistory.replaceState so the browser’s history isn’t polluted.
No first-paint flash
Hash-targeted content is hidden during initial parse via acdx-hash-pending class on<html>; it is removed after the initial hash is applied, so deep-linked pages never flash their default state before settling.
Hosting anywhere
Links between pages are relative, so the docs can sit at a domain root, in a sub-folder, or in a per-version folder under /documentation/<label>/ with no base-path setting. A site opened from disk keeps its interactive parts too; only search needs a server, because Pagefind fetches its index.
The version switcher follows redirects.json, written with every version, so a hop lands on the same symbol when its page moved between releases.