这是我的模板:
<ng-template #template> <input #newimg type="file" class="col-md-10" (change)="fileChange($event)"/> </ng-template>
当它的内部ng模板时,我无法引用#newimg(如果我将ng-template更改为div,它可以正常工作!)
@ViewChild('newimg') img: ElementRef; //doesnt work
我需要在上传图像后将其值设置为空,但始终未定义.