feat: refactor input component to use model binding for value management
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
computed,
|
||||
effect,
|
||||
input,
|
||||
model,
|
||||
output,
|
||||
signal,
|
||||
untracked,
|
||||
@@ -71,7 +72,7 @@ export class InputComponent {
|
||||
readonly invalid = input(false);
|
||||
readonly id = input(this.defaultId);
|
||||
readonly placeholder = input('');
|
||||
readonly value = input<string | number>('');
|
||||
readonly value = model<string | number>('');
|
||||
readonly maxlength = input<number | null>(null);
|
||||
readonly accept = input('');
|
||||
readonly fileName = input('');
|
||||
@@ -83,7 +84,6 @@ export class InputComponent {
|
||||
});
|
||||
|
||||
readonly disabledChange = output<boolean>();
|
||||
readonly valueChange = output<string>();
|
||||
readonly fileChange = output<File | null>();
|
||||
readonly visibleChange = output<boolean>();
|
||||
|
||||
@@ -167,7 +167,7 @@ export class InputComponent {
|
||||
}
|
||||
|
||||
protected onValueChange(event: Event): void {
|
||||
this.valueChange.emit((event.target as HTMLInputElement).value);
|
||||
this.value.set((event.target as HTMLInputElement).value);
|
||||
}
|
||||
|
||||
protected onFileChange(event: Event): void {
|
||||
|
||||
Reference in New Issue
Block a user