File

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

Implements

OnInit OnDestroy

Metadata

Selector [cxSkipLink]

Index

Properties
Methods
Inputs

Constructor

constructor(elementRef: ElementRef, skipLinkService: SkipLinkService)
Parameters :
Name Type Optional
elementRef ElementRef<HTMLElement> No
skipLinkService SkipLinkService No

Inputs

cxSkipLink
Type : string

Methods

ngOnDestroy
ngOnDestroy()
Returns : void
ngOnInit
ngOnInit()
Returns : void

Properties

cxSkipLink
Type : string
Decorators :
@Input()
import { Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
import { SkipLinkService } from '../service/skip-link.service';

@Directive({
  selector: '[cxSkipLink]',
})
export class SkipLinkDirective implements OnInit, OnDestroy {
  @Input() cxSkipLink: string;

  constructor(
    protected elementRef: ElementRef<HTMLElement>,
    protected skipLinkService: SkipLinkService
  ) {}

  ngOnInit(): void {
    this.skipLinkService.add(this.cxSkipLink, this.elementRef.nativeElement);
  }

  ngOnDestroy(): void {
    this.skipLinkService.remove(this.cxSkipLink);
  }
}

result-matching ""

    No results matching ""