File

projects/storefrontlib/layout/a11y/skip-link/component/skip-link.component.ts

Metadata

changeDetection ChangeDetectionStrategy.OnPush
selector cx-skip-link
templateUrl ./skip-link.component.html

Index

Properties
Methods

Constructor

constructor(skipLinkService: SkipLinkService)
Parameters :
Name Type Optional
skipLinkService SkipLinkService No

Methods

scrollToTarget
scrollToTarget(skipLink: SkipLink)
Parameters :
Name Type Optional
skipLink SkipLink No
Returns : void

Properties

skipLinks$
Type : Observable<SkipLink[]>
Default value : this.skipLinkService.getSkipLinks()
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Observable } from 'rxjs';
import { SkipLink } from '../config/skip-link.config';
import { SkipLinkService } from '../service/skip-link.service';

@Component({
  selector: 'cx-skip-link',
  templateUrl: './skip-link.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SkipLinkComponent {
  skipLinks$: Observable<SkipLink[]> = this.skipLinkService.getSkipLinks();

  constructor(private skipLinkService: SkipLinkService) {}

  scrollToTarget(skipLink: SkipLink): void {
    this.skipLinkService.scrollToTarget(skipLink);
  }
}
<div [cxFocus]="{ tab: true }" *ngIf="skipLinks$ | async as links">
  <button *ngFor="let link of links" (click)="scrollToTarget(link)">
    {{ 'skipLink.skipTo' | cxTranslate }}
    {{ link.i18nKey | cxTranslate }}
  </button>
</div>
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""