【问题标题】:Is there a way to create a Drag and Drop input for file upload in Angular 5?有没有办法在 Angular 5 中为文件上传创建拖放输入?
【发布时间】:2019-09-11 21:58:09
【问题描述】:

我需要将简单的上传输入字段更改为“拖放”上传。

我做了一些研究,但没有找到关于 Angular 5 的任何线索。我尝试使用 ngx-file-drop,但遇到了兼容性错误。


@angular/compiler-cli@5.2.11 requires a peer of typescript@>=2.4.2 <2.7 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-file-drop@6.0.0 requires a peer of @angular/common@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-file-drop@6.0.0 requires a peer of @angular/platform-browser@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-file-drop@6.0.0 requires a peer of @angular/platform-browser-dynamic@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-file-drop@6.0.0 requires a peer of rxjs@^6.3.3 but none is installed. You must install peer dependencies yourself.

我想查看 Angular 5 项目中拖放的示例和实现。

【问题讨论】:

  • 这些依赖警告就是它们的本来面目,警告。如果没有错误,您可以安全地使用它。或者安装旧版本的 ngx-file-drop,它确实支持 angular 5。

标签: angular typescript angular5


【解决方案1】:

您可以使用angular-file-uploaderlink。 Angular 文件上传器是一个 Angular 2/4/5/6 文件上传器模块,具有实时进度条、Angular 通用兼容性和多个主题,包括拖放等等。

或者您可以使用ng-file-upload进行拖放文件上传。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-12-01
    • 1970-01-01
    • 2018-05-04
    • 1970-01-01
    • 2011-05-28
    • 2014-02-05
    • 1970-01-01
    相关资源
    最近更新 更多