CngxBreadcrumbRouterSync
projects/ui/breadcrumb/breadcrumb-router-sync.directive.ts
Import#
import { CngxBreadcrumbRouterSync } from '@cngx/ui/breadcrumb'
Description#
Opt-in router mode for CngxBreadcrumbBar. Add routerSync to a
<cngx-breadcrumb> and the trail is derived from the activated route tree -
every route whose data[dataKey] (default data.breadcrumb) is a non-empty
string contributes a crumb, terminal marking follows from position. The bar
reads the trail through the CNGX_BREADCRUMB_ITEMS_SOURCE seam
(provided here via useExisting), so the directive never writes the bar's
[items] input and never injects the concrete bar class - decompose-clean
(Pillar 1; reference_atomic_decompose rule 4).
The navigation stream converts to a signal at the boundary via toSignal
(Pillar 1, no raw subscription); the trail is a computed over that trigger
and dataKey, carrying a shape-based equal so a same-shape navigation does
not cascade the trail. Router is optional - without it the directive logs a
dev warning and stays an empty source.
<cngx-breadcrumb cngxRouterSync />// Route config supplies the crumb labels:
{ path: 'catalog', data: { breadcrumb: 'Catalog' }, children: [
{ path: 'books', data: { breadcrumb: 'Books' } },
] }Metadata#
Providers#
CNGX_BREADCRUMB_ITEMS_SOURCE- useExisting
CngxBreadcrumbRouterSync