projects/storefrontlib/layout/a11y/skip-link/directive/skip-link.directive.ts
| Selector | [cxSkipLink] |
Properties |
Methods |
Inputs |
constructor(elementRef: ElementRef
|
|||||||||
|
Parameters :
|
| cxSkipLink | |
Type : string
|
|
| ngOnDestroy |
ngOnDestroy()
|
|
Returns :
void
|
| ngOnInit |
ngOnInit()
|
|
Returns :
void
|
| 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);
}
}