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

Function isActive

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

Source from the content-addressed store, hash-verified

123 * @publicApi 21.1
124 */
125export function isActive(
126 url: string | UrlTree,
127 router: Router,
128 matchOptions?: Partial<IsActiveMatchOptions>,
129): Signal<boolean> {
130 const urlTree = url instanceof UrlTree ? url : router.parseUrl(url);
131 return computed(() =>
132 containsTree(
133 router.lastSuccessfulNavigation()?.finalUrl ?? new UrlTree(),
134 urlTree,
135 matchOptions,
136 ),
137 );
138}
139
140/**
141 * 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