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

前端 未结 8 2236
感情败类
感情败类 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:31

    Try using ng-attr-

     ng-attr-class="{{someBoolean && 'class-when-true' || 'class-when-false' }}"
    

    If you prefix any attribute with ng-attr-, then the compiler will strip the prefix, and add the attribute with its value bound to the result of the angular expression from the original attribute value.

提交回复
热议问题