CngxMatTabNav
projects/ui/mat-tabs/mat-tab-nav.directive.ts
Import#
import { CngxMatTabNav } from '@cngx/ui/mat-tabs'
Description#
Layers the cngx error / rejection / announcement layer onto
Material's native router tabs (<nav mat-tab-nav-bar> /
<a mat-tab-link> / <mat-tab-nav-panel>). The parallel bridge to
CngxMatTabs: MatTabNav has no MatTab and no
selectedIndex, so handles register per <a mat-tab-link> via
CngxMatTabLink, and the decoration projectors target
.mat-mdc-tab-link instead of .mat-mdc-tab.
Gating is native: each link is a routerLink, so the router runs
CanDeactivate directly and this directive installs no
commit-action. The active index follows the route - add
[cngxTabsRouteSync] to the same <nav> and give each
[cngxMatTabLink] an id matching its route segment; route-sync
reflects NavigationEnd onto activeIndex (its commit-action stays
dormant because link clicks navigate natively, never through
presenter.select). Ableitung statt Verwaltung - the route-active
link is the single source of the active index. activeIndex /
activeIndexChange are forwarded from the presenter hostDirective,
so a consumer without route-sync can two-way bind the active link
the same way [cngxMatTabs] consumers do.
Active-link changes speak: the shared nav announcement bundle (createTabNavAnnouncement) feeds the landing link's label to the shared live announcer - silent through the mount window, so a deep link's initial active state is not announced as a change.
Composes CngxTabGroupPresenter via hostDirectives so the
CNGX_STATEFUL producer, the lastFailedIndex rejection slot, and
the live-region announcer come for free, identical to the cngx
organism (Pillar 2 - same communication across skins).
Decoration content-template slots (*cngxMatTabRejectionContent /
*cngxMatTabAggregatorContent) are not forwarded on this bridge yet -
the projectors render their built-in cngx-sr-only spans. The slot
inputs that [cngxMatTabs] exposes are a deferred follow-up.
Metadata#
Providers#
CNGX_TAB_NAV_HOST- useValue
true
Relationships
Depends on1
Index#
Methods
Methods#
Clears presenter.lastFailedIndex, dismissing the rejection
decoration. Mirrors CngxMatTabs.clearLastFailed so a
template ref (#nav="cngxMatTabNav") is enough.