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