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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user