Search code examples
angularjsangular-file-uploadng-file-upload

show alert box when user select non accepted file in danialfarid/ng-file-upload plugin


  • I am using danialfarid/ng-file-upload plugin ,I set the ngf-select directive to .doc,.pdf extension. Its working fine.

  • Problem is if a user select .png or jpg file, I want to show an alert box to user that this file type are not accepted. Thanks for in advance.


Solution

  • Something like this:

    <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>