• Genel Bakış
@angular/router

isActive

function
kararlıv21.1'den beri

Returns a computed signal of whether the given url is activated in the Router.

API

function isActive(
  url: string | UrlTree,
  router: Router,
  matchOptions?: Partial<IsActiveMatchOptions> | undefined,
): Signal<boolean>;
@paramurlstring | UrlTree
@paramrouterRouter
@parammatchOptionsPartial<IsActiveMatchOptions> | undefined
@returnsSignal<boolean>

Description

Returns a computed signal of whether the given url is activated in the Router.

As the router state changes, the signal will update to reflect whether the url is active.

When using the matchOptions argument, any missing properties fall back to the following defaults:

  • paths: 'subset'
  • queryParams: 'subset'
  • matrixParams: 'ignored'
  • fragment: 'ignored'
Detaylara atla