简体   繁体   中英

How to make file type mandatory(Required) field in angularjs?

Hi I am developing web application in angularjs. I am developing file upload module. I am doing it dynamically. I will get a list of files to be uploaded from api call. Once i get list i assign dynamically to scope variable of ng-repeat directive as below.

<div class="upload-button" ng-repeat="fileInput in fileInputs">
    <div ng-if="fileInput.Filepath == ''">
        <input type="file" file-data="{{fileInput.Filename}}" file-model="
        {{fileInput.Filename}}" id="file_input_id" required valid-file/>
    </div>
</div>

Suppose if i get 7 files from api then i will get 7 file upload controls. I want to make all 7 controls mandatory on submiting the form. May i know how this can be done? Any help would be appreciated. Thank you.

Maybe try using the ng-file-upload directive. this has everything that you need to upload files and easy to use. i've use this on all apps i developed.

check ng-file-upload github

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM