ngf-max-size $digest() error with ng-file-upload in angular.js

前端 未结 1 397
陌清茗
陌清茗 2021-01-26 04:22

This is source code.

1条回答
  •  不思量自难忘°
    2021-01-26 04:58

    You shouldn't change your model inside watch since it creates a loop. If you just need to alert when a file is uploaded whether the size is above you can just check the status.

    Let's say you have this input:

     
    

    Then you just need to have this in your html to show the limit size exceeded alert:

    File too large 
          {{errorFile.size / 1000000|number:1}}MB: max 1M
    

    And also you don't need a directive to handle that.

    Check here for more info around validation.

    0 讨论(0)
提交回复
热议问题