1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 06:43:35 +00:00

[PM-9113] Trim Whitespace from email in sponsorship form (#9781)

* 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
This commit is contained in:
Conner Turnbull
2024-07-11 09:04:51 -04:00
committed by GitHub
parent e977dacdcf
commit 36030c3763
7 changed files with 13 additions and 7 deletions

View File

@@ -1,12 +1,17 @@
import { Directive, ElementRef, HostListener } from "@angular/core";
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>) {}
constructor(
private el: ElementRef<HTMLInputElement>,
@Self() private ngControl: NgControl,
) {}
@HostListener("input") onInput() {
this.el.nativeElement.value = this.el.nativeElement.value.replace(/ /g, "");
const value = this.el.nativeElement.value.replace(/\s+/g, "");
this.ngControl.control.setValue(value);
}
}