html - AngularJs Disable Submit Button Until A File Upload Path Selected -


i'm new angularjs , can seem find solution problem. have file upload field on site , submit button. page has drop down list , disabled submit button when user first hits page. submit button enable once selection made drop down list. works great have been asked add file upload option list have done , file upload <input type="file"> field displayed when selected.

the issue have when user selects upload option it's enabling button , want submit button enabled once file path has been selected.

at moment enabling/disabling of button done in view shown below.

            <div class="form-group">                 <div class="col-sm-8">                     <select name="selectedbankaccountname" ng-options="choice choice in bankaccountnames" ng-model="selectedbankaccountname" class="form-control" style="width:100% !important" focus-on="setfocus" required>                         <option></option>                     </select>                 </div>                 <!-- todo - button needs disabled if bank upload selected & file not selected -->                 <button type="submit" class="btn btn-success" ng-disabled="startautoreconciliation.selectedbankaccountname.$invalid || disablebutton" ng-click="startrec()" title="click start auto reconciliation procedure.">start auto rec</button>             </div>             <div class="form-group" ng-if="bankreconciliation.reconciliationtype == 'bank file upload'">                 <div class="col-sm-12">                     <p>please ensure have copied selected file designated folder prior uploading bank file.</p>                     <input type="file" style="width: 100%; height: 35px; border: none !important; cursor: pointer" onchange="angular.element(this).scope().file_changed(this)" ng-model="bankfilepath" />                 </div>             </div> 

can shed light on how can working.

in submit button, ng-disabled attribute

ng-disabled="!bankfilepath  || startautoreconciliation.selectedbankaccountname.$invalid || disablebutton" 

check bankfilepath well.

so button enabled if file selected. bankfilepath undefined , once user has selected file, have file path.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -