Created
May 20, 2020 02:07
-
-
Save FrenchTechLead/773b63e4c786608c0ce9618936b99380 to your computer and use it in GitHub Desktop.
Angular directive to disable chrome's form autocomplete.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Directive, ElementRef } from '@angular/core'; | |
@Directive({ | |
selector: '[autocompleteOff]' | |
}) | |
export class AutocompleteOffDirective { | |
constructor(private _el: ElementRef) { | |
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