1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-30 23:23:52 +00:00
Files
browser/libs/angular/src/directives/input-strip-spaces.directive.ts
Oscar Hinton ac49e594c1 Add standalone false to all non migrated (#14797)
Adds standalone: false to all components since Angular is changing the default to true and we'd rather not have the angular PR change 300+ files.
2025-05-15 10:44:07 -04:00

21 lines
599 B
TypeScript

// 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);
}
}