Skip to main content
cngx-src documentation

createTabRouterCommit

Functioncommon/tabsv0.1.0

projects/common/tabs/router-commit.ts

Description#

Builds a CngxTabsCommitAction that gates a tab switch through @angular/router. The action navigates to the target tab's route and resolves on the router's own outcome:

  • NavigationEndtrue (commit the switch)
  • NavigationCancel (a CanDeactivate guard blocked) → false
  • NavigationError (guard/resolver threw) → false

Routed tabs reuse the presenter's commit lifecycle verbatim - the router navigation is simply the async op.
In pessimistic mode the active tab follows the resolved route, so a cancelled guard keeps the old tab with zero extra gate machinery. The events subscription is opened before navigate(...) so a synchronously-resolving navigation cannot emit before the action is listening; the commit controller's cancel() unsubscribes on supersede.

Signature#

createTabRouterCommit(opts: CngxTabRouterCommitOptions)

Parameters#

Returns#

CngxTabsCommitAction