简体   繁体   中英

Input file upload is not working inside Angular Material Menu

I have Angular Material Menu & placed input file upload control. The file choosing window is not coming when I click on the file upload control. It is not working because the file input is there inside the Angular material menu.

<mat-menu #menu="matMenu" [overlapTrigger]="false">
<input type="file"/> 
</mat-menu>

If any suggestions to work the input file type inside the menu

It is working outside a form:

<button mat-button [matMenuTriggerFor]="menu">Menu</button>
<mat-menu #menu="matMenu" [overlapTrigger]="false">
  <input (click)="$event.stopPropagation()" type="file"/> 
</mat-menu>

(click)="$event.stopPropagation()" allows you to keep the menu open after clicking on the "Browse" button of the input.

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