如何在角材料中使用输入类型文件 [英] How to use input type file in angular material
本文介绍了如何在角材料中使用输入类型文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在角材料中使用输入类型文件
我正在使用角材料进行设计.当我访问 angular material 站点时,没有输入类型文件元素.任何人都知道这件事.
Hi, I am using angular material for designing. when i go on angular material site there no input type file element. anyone know about this.
推荐答案
Angular Material 尚不支持文件上传的解决方法.有其他方法可以存档.例如使用外部库.
Angular Material does not support yet a workaround for file upload. There are alternative to archieve this. e.g using external libraries.
angular-material-fileupload:链接到 npm 包
支持的功能:
- 拖放
- 常见上传
- 进度条
- 文件大小等等...
ngx-material-file-input:链接到存储库
支持的功能:
ngx-mat-file-input
组件,用于 Angular Materialmat-form-field
- 一个带有
maxContentSize
的FileValidator
,用于限制文件大小 - a
ByteFormatPipe
以人类可读的格式格式化文件大小 - 以及更多小的小功能...
ngx-mat-file-input
component, to use inside Angular Materialmat-form-field
- a
FileValidator
withmaxContentSize
, to limit the file size - a
ByteFormatPipe
to format the file size in a human-readable format - and more small minor features...
更新
如果您只需要一个没有外部库的解决方法,请在此处查看答案https://stackoverflow.com/a/53546417/6432698
See the answer here if you just need a workaround without external library https://stackoverflow.com/a/53546417/6432698
这篇关于如何在角材料中使用输入类型文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文