angular-clickable-click
Version:
Angular 2+ Directive setting 'cursor: pointer' for all elements using (click) directive
16 lines (13 loc) • 615 B
text/typescript
import { Directive, HostBinding, Input, OnChanges, SimpleChanges } from '@angular/core';
export class ClickDirective implements OnChanges {
disabled: boolean = false;
cursor: string = 'pointer';
pointerEvents: string = 'auto';
public ngOnChanges(changes: SimpleChanges) {
if (changes['disabled']) {
this.pointerEvents = this.disabled ? 'none' : 'auto';
this.cursor = this.disabled ? 'not-allowed' : 'pointer';
}
}
}