0

I have used this post to crate binding:

Angular HTML binding

but messed up with an error:

Property 'value' does not exist on type 'EventTarget'.

Wherе might be the point?

html: <input [value]="test" (input)="test = $event.target.value">

"test" is a property of a component.

Question might be stupid, but I have tested different ways to solve the problem and see no way out. Thanks for any help.

XEX
  • 27
  • 4

1 Answers1

2
<input [value]="test" (input)="onInput($event)">
onInput(event: Event) {
  this.test = ($event.target as HTMLInputElement).value;
}
Eugene
  • 1,242
  • 1
  • 10
  • 15