当用户在danialfarid / ng-file-upload插件中选择不接受的文件时显示警告框

时间:2015-08-31 11:22:14

标签: angularjs angular-file-upload ng-file-upload

  • 我正在使用danialfarid/ng-file-upload插件,我设置了ngf-select 指令.doc,.pdf扩展名。它的工作正常。

  • 问题是如果用户选择.png或jpg文件,我想显示提醒 用户不允许使用此文件类型的框。谢谢 提前。

1 个答案:

答案 0 :(得分:2)

这样的事情:

<div ngf-select ngf-pattern="'.png,.jpg'" ng-model="file">

<div class="alert" ng-show="file.$error === 'pattern'">file type is not accepted. Acceptable files: {{file.$errorParam}}</div>