How to reset selected file with input tag file type in Angular 2?

前端 未结 13 1913
北恋
北恋 2020-12-12 14:56

This is how my input tag looks like:


13条回答
  •  情书的邮戳
    2020-12-12 15:25

    If you are facing issue with ng2-file-upload,

    HTML:

    
    

    component

    import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
    
    @ViewChild('`**activeFrameinputFile**`') `**InputFrameVariable**`: ElementRef;
    
    this.frameUploader.onSuccessItem = (item, response, status, headers) => {
        this.`**InputFrameVariable**`.nativeElement.value = '';
       };
    

提交回复
热议问题