Property 'files' does not exist on type 'EventTarget' error in typescript

后端 未结 7 686
迷失自我
迷失自我 2020-11-30 09:50

I am trying to access the value of the input file from my ionic 2 application but still I\'m facing the issue of property files does not exist on type \'EventTarget\'. As it

相关标签:
7条回答
  • 2020-11-30 10:26

    I have found that:

    <input type="file"  accept="image/*" 
    (change)="upload($event)">
    

    and

    <ion-input type="file"  accept="image/*" 
    (change)="upload($event)"><ion-input>  or (ionChange)
    

    does not handle the event in the same way. Therefore event.target consists of different parameters.

    I therefore did not use the ion-input tag, but the normal angular <input> tag with the (change)="upload($event)" trigger.

    It worked for me on Ionic 4.

    0 讨论(0)
提交回复
热议问题