Conditional “multiple” attribute in <input type=“file”> with AngularJS

前端 未结 8 2218
感情败类
感情败类 2021-01-11 18:02

I need an upload form field that may or may not allow the user to select more than one file.

I know I can do something like:



        
8条回答
  •  死守一世寂寞
    2021-01-11 18:24

    I am on mobile, sorry for the short answer.

    I would hide two different file inputs, one with the multiple attribute and one without. You can use the ng-if directive to achieve that.

    Edit: I'm so sorry, seems like you don't want to do it that way, even though it's completely valid. You could write your own directive for it however, it's really simple.

提交回复
热议问题