Он работал в версии Angular 14, но эта проблема возникла после обновления до 15. Текущая версия материала "@ angular/material": "^15.2.9",
Код: Выделить всё
Код: Выделить всё
photo_camera
Код: Выделить всё
acquireImage() {
if (this.isCaptureSupported()) {
const inputAcquire = document.getElementById('hiddenInputAcquire') as HTMLInputElement;
if (inputAcquire) {
//error appears here
inputAcquire.click();
}
return;
}
const dialogRef = this.dialog.open(AcquireImageDialogComponent);
dialogRef.componentInstance.useToCropExistingImage = undefined;
dialogRef.componentInstance.interactiveCropping = this.useCropper;
this.acquireDialogSub?.unsubscribe();
this.acquireDialogSub = dialogRef.afterClosed().subscribe((res: AcquireImageDialogResult) => {
if (res.isImageProvided) {
this.assignPicture(res.fileId);
}
});
}
Код: Выделить всё
private isCaptureSupported() {
const ele = document.createElement('input');
return 'capture' in ele;
}
- Я попробовал это.hiddenInputAcquire.nativeElement.click();
Подробнее здесь: https://stackoverflow.com/questions/786 ... g-click-er