简体   繁体   中英

Event does not fire more than once

In my angular app i am trying to upload a file. I am having problem with firing the event every time i select the file. I am able to fire the event for first time but it does not work next time. How can i resolve it. please guide me.

HTML

 <div class="col-md-5 d-flex justify-content-center">
            <label class="file-label" for="file-upload">Please upload your data. click here!
              <i class="fa fa-upload"></i>
            </label>
            <input type="file" id="file-upload" accept=".zip" (change)="onFileSelected($event)" [hidden]="true">
          </div>

TS

onFileSelected(event) {
console.log(event.target.files);
}

After selecting a file you should clean input value event.target.value = '' .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM