HTML代码
`<mat-form-field>
<input type="file" (change)="onFileSelected($event)" name="categoryImage" >
</mat-form-field>`TS代码
onFileSelected(event){
console.log(event);}甚至在操作前获取错误- mat-form-field必须包含MatFormFieldControl。在这一行getMatFormFieldMissingControlError
发布于 2019-01-05 01:26:15
<mat-form-field>不支持<input type="file" />,据我所知,目前还没有支持它的东西。只需完全删除mat-form-field元素。
表单在没有它的情况下仍然可以工作。
https://stackoverflow.com/questions/51594636
复制相似问题