mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 06:43:35 +00:00
* Removed whitespace from email form when setting up families sponsorship * Moved sponsorship components to billing folder * Updated to use existing input stripping directive * Updated appInputStripSpaces to update both the element and the control value * Removed the call to Renderer2 as it wasn't needed
18 lines
484 B
TypeScript
18 lines
484 B
TypeScript
import { Directive, ElementRef, HostListener, Self } from "@angular/core";
|
|
import { NgControl } from "@angular/forms";
|
|
|
|
@Directive({
|
|
selector: "input[appInputStripSpaces]",
|
|
})
|
|
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);
|
|
}
|
|
}
|