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

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

    You can use ngSwitch directive for this. Take a look in AngularJs documentation for more details.

    https://docs.angularjs.org/api/ng/directive/ngSwitch

    In this demo example the directive switch between input file with and without multiple based in a scope param passed for directive using ngSwitch directive.

    Demo using ngSwitch

提交回复
热议问题