angular-material-components icon indicating copy to clipboard operation
angular-material-components copied to clipboard

Opening file-input on button click

Open usersina opened this issue 4 years ago • 1 comments

I want to be able to open the input from a button like so

<div>
  <button (click)="myInput.open()">Upload a file</button>
  <mat-form-field appearance="standard">
    <mat-label>Your pdf file</mat-label>
    <ngx-mat-file-input [multiple]="false" [accept]="'.pdf'" #myInput>
    </ngx-mat-file-input>
  </mat-form-field>
</div>

However this doesn't work since Property 'open' does not exist on type 'NgxMatFileInputComponent'.

Is there a way to make it work?

usersina avatar Aug 24 '21 11:08 usersina

(click)="myInput.openFilePicker($event);" or (click)="myInput.openFilePicker();" shoud do the trick

jlafuenteriberaLM avatar Jan 31 '22 08:01 jlafuenteriberaLM