| 374 | private readonly reactiveRouterState = inject(ReactiveRouterState); |
| 375 | |
| 376 | constructor( |
| 377 | private router: Router, |
| 378 | private route: ActivatedRoute, |
| 379 | @Attribute('tabindex') private readonly tabIndexAttribute: string | null | undefined, |
| 380 | private readonly renderer: Renderer2, |
| 381 | private readonly el: ElementRef, |
| 382 | private locationStrategy?: LocationStrategy, |
| 383 | ) { |
| 384 | const tagName = el.nativeElement.tagName?.toLowerCase(); |
| 385 | this.isAnchorElement = |
| 386 | tagName === 'a' || |
| 387 | tagName === 'area' || |
| 388 | !!( |
| 389 | // Avoid breaking in an SSR context where customElements might not |
| 390 | // be defined. |
| 391 | ( |
| 392 | typeof customElements === 'object' && |
| 393 | // observedAttributes is an optional static property/getter on a |
| 394 | // custom element. The spec states that this must be an array of |
| 395 | // strings. |
| 396 | ( |
| 397 | customElements.get(tagName) as {observedAttributes?: string[]} | undefined |
| 398 | )?.observedAttributes?.includes?.('href') |
| 399 | ) |
| 400 | ); |
| 401 | |
| 402 | if (typeof ngDevMode !== 'undefined' && ngDevMode) { |
| 403 | effect(() => { |
| 404 | if ( |
| 405 | isUrlTree(this.routerLinkInput()) && |
| 406 | (this._fragment() !== undefined || |
| 407 | this._queryParams() || |
| 408 | this._queryParamsHandling() || |
| 409 | this._preserveFragment() || |
| 410 | this._relativeTo()) |
| 411 | ) { |
| 412 | throw new RuntimeError( |
| 413 | RuntimeErrorCode.INVALID_ROUTER_LINK_INPUTS, |
| 414 | 'Cannot configure queryParams or fragment when using a UrlTree as the routerLink input value.', |
| 415 | ); |
| 416 | } |
| 417 | }); |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | /** |
| 422 | * Modifies the tab index if there was not a tabindex attribute on the element |