@Shivendra-Parmar wrote:
Hi,
I have used ion-input with type=“file” but when I click on that to upload a file It does not open the file dialog and following warning comes:
File chooser dialog can only be shown with user activation.
I looked around and found out some solutions that show using the button to trigger the click for dialog
but It didn’t work possibly I am doing something wrong,
Here is my code:<ion-input type="file" accept="jpg, png, jpeg" [(ngModel)] = "file" (change) = "addImage($event, 'card')" required #cardPicker></ion-input> <ion-button fill="clear" (click)="cardPicker.click()" class="dialog">Add card Image</ion-button>
I have also tried native input element with following code but that also did not help
<input type="file" #card> <button class="dialog" (click)="card.click()">Add card Image</button>
What I am doing wrong?
Posts: 1
Participants: 1