Property 'value' does not exist on type EventTarget in TypeScript

后端 未结 8 1066
野趣味
野趣味 2020-11-29 17:06

So the following code is in Angular 4 and I can\'t figure out why it doesn\'t work the way as expected.

Here is a snippet of my handler:

onUpdatingSe         


        
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 18:04

    Passing HTMLInputElement as a generic to the event type should work too:

    onUpdatingServerName(event: React.ChangeEvent) {
      console.log(event);
      this.newserverName = event.target.value;
    }
    

提交回复
热议问题