CngxTocRouterSync
projects/ui/toc/toc-router-sync.directive.ts
Import#
import { CngxTocRouterSync } from '@cngx/ui/toc'
Description#
Deep-links a CngxToc into the URL fragment. Opt-in via
[cngxTocRouterSync] on the same host as <cngx-toc>: activating a link
writes #<section-id> (replacing the history entry, so a scroll-driven rail
never floods the back stack), and a deep link like /guide#pricing scrolls
to that section once on load.
Reaches the rail through the CNGX_TOC contract token, never the
concrete CngxToc class. The activation subscription is torn down with the
directive via takeUntilDestroyed - an OutputRef subscription would
otherwise outlive route changes. Without @angular/router the directive
dev-warns once and no-ops.