Bitwarden client applications (web, browser extension, desktop, and cli)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

20 lines
599 B

// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { Directive, ElementRef, HostListener, Self } from "@angular/core";
import { NgControl } from "@angular/forms";
@Directive({
selector: "input[appInputStripSpaces]",
standalone: false,
})
export class InputStripSpacesDirective {
constructor(
private el: ElementRef<HTMLInputElement>,
@Self() private ngControl: NgControl,
) {}
@HostListener("input") onInput() {
const value = this.el.nativeElement.value.replace(/\s+/g, "");
this.ngControl.control.setValue(value);
}
}