Skip to content

Instantly share code, notes, and snippets.

@FrenchTechLead
Created March 18, 2021 09:57
Show Gist options
  • Save FrenchTechLead/4298fd5330dc70d182e02275012d8272 to your computer and use it in GitHub Desktop.
Save FrenchTechLead/4298fd5330dc70d182e02275012d8272 to your computer and use it in GitHub Desktop.
import { Directive, ElementRef } from '@angular/core';
@Directive({
selector: '[autocompleteOff]'
})
export class AutocompleteOffDirective {
constructor(private _el: ElementRef) {
let w: any = window;
let isChrome = w.chrome;
if (isChrome) {
this._el.nativeElement.setAttribute('autocomplete', 'off');
this._el.nativeElement.setAttribute('autocorrect', 'off');
this._el.nativeElement.setAttribute('autocapitalize', 'none');
this._el.nativeElement.setAttribute('spellcheck', 'false');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment