I have a simple Directive as follows:
import { Directive, OnInit, OnDestroy, ElementRef } from "@angular/core";
@Directive({
selector: "[Checker]"
})
export class Checker {
constructor(private e: ElementRef) {
}
OnInit() {
this.e.nativeElement.setAttribute("spellcheck", "true");
}
keyFunc(event: KeyboardEvent) {
if (event.keyCode == 74) {
//more functionality
}
}
}
So, whenever I add this directive selector to any tag, I set the spellcheck attribute to true.
How can I set this attribute in an Angular2 way, i.e. what is the alternative Angular way to do this?