| 405 | private readonly reactiveRouterState = inject(ReactiveRouterState); |
| 406 | |
| 407 | constructor( |
| 408 | private router: Router, |
| 409 | private route: ActivatedRoute, |
| 410 | @Attribute('tabindex') private readonly tabIndexAttribute: string | null | undefined, |
| 411 | private readonly renderer: Renderer2, |
| 412 | private readonly el: ElementRef, |
| 413 | private locationStrategy?: LocationStrategy, |
| 414 | ) { |
| 415 | const tagName = el.nativeElement.tagName?.toLowerCase(); |
| 416 | this.isAnchorElement = |
| 417 | tagName === 'a' || |
| 418 | tagName === 'area' || |
| 419 | !!( |
| 420 | // Avoid breaking in an SSR context where customElements might not |
| 421 | // be defined. |
| 422 | typeof customElements === 'object' && |
| 423 | // observedAttributes is an optional static property/getter on a |
| 424 | // custom element. The spec states that this must be an array of |
| 425 | // strings. |
| 426 | ( |
| 427 | customElements.get(tagName) as {observedAttributes?: string[]} | undefined |
| 428 | )?.observedAttributes?.includes?.('href') |
| 429 | ); |
| 430 | |
| 431 | if (typeof ngDevMode !== 'undefined' && ngDevMode) { |
| 432 | effect(() => { |
| 433 | if ( |
| 434 | isUrlTree(this.routerLinkInput()) && |
| 435 | (this._fragment() !== undefined || |
| 436 | this._queryParams() || |
| 437 | this._queryParamsHandling() || |
| 438 | this._preserveFragment() || |
| 439 | this._relativeTo()) |
| 440 | ) { |
| 441 | throw new RuntimeError( |
| 442 | RuntimeErrorCode.INVALID_ROUTER_LINK_INPUTS, |
| 443 | 'Cannot configure queryParams or fragment when using a UrlTree as the routerLink input value.', |
| 444 | ); |
| 445 | } |
| 446 | }); |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | /** |
| 451 | * Modifies the tab index if there was not a tabindex attribute on the element |