Home > other >  Property 'value' does not exist on type 'EventTarget' in Angular
Property 'value' does not exist on type 'EventTarget' in Angular

Time:09-01

Browser shows failed to compile. Please help

Error : Property 'value' does not exist on type 'EventTarget'

HTML code :

<div>
  <label>Enter Length</label>
  <input (input)="onChangeLength($event.target.value)" />
</div>

Typescript code

  onChangeLength(value: string){

    const parsedValue = parseInt(value);

    if(!isNaN(parsedValue)){
      this.lenght = parsedValue;
    }

   }

CodePudding user response:

event.target is of type EventTarget which does not have the property value: enter image description here

  • Related