( url: string | UrlTree, router: Router, matchOptions?: Partial<IsActiveMatchOptions>, )
| 117 | * @publicApi 21.1 |
| 118 | */ |
| 119 | export 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. |
no test coverage detected