【发布时间】:2018-07-27 08:07:44
【问题描述】:
我想触发/打开来自 Ionic 4 中另一个页面的文件输入。
在第 1 页我有一个按钮可以转到模式,在页面模式中我想自动触发 <input file> 对话框
组件
ionViewWillEnter() {
document.getElementById('file').click(); // Tried with this one 1st, this only works in Internet Explorer / Edge
this.fileInput.nativeElement.click(); // And also this with @ViewChild
}
HTML
<input type="file" name="file" #file id="file" (change)="fileChange($event)" required>
【问题讨论】:
标签: javascript html angular ionic-framework