MCPcopy Create free account
hub / github.com/angular/angular / isActive

Function isActive

packages/router/src/url_tree.ts:119–132  ·  view source on GitHub ↗
(
  url: string | UrlTree,
  router: Router,
  matchOptions?: Partial<IsActiveMatchOptions>,
)

Source from the content-addressed store, hash-verified

117 * @publicApi 21.1
118 */
119export function isActive(
120 url: string | UrlTree,
121 router: Router,
122 matchOptions?: Partial<IsActiveMatchOptions>,
123): Signal<boolean> {
124 const urlTree = url instanceof UrlTree ? url : router.parseUrl(url);
125 return computed(() =>
126 containsTree(
127 router.lastSuccessfulNavigation()?.finalUrl ?? new UrlTree(),
128 urlTree,
129 matchOptions,
130 ),
131 );
132}
133
134/**
135 * Determines if a `UrlTree` is contained within another `UrlTree` based on the provided matching options.

Callers 3

url_tree.spec.tsFile · 0.90
isLinkActiveMethod · 0.90

Calls 4

computedFunction · 0.90
containsTreeFunction · 0.85
parseUrlMethod · 0.45

Tested by

no test coverage detected