2
<input type="file" ng-file-select ng-model="file" accept=".xls" name="inputFile" id="inputFile" required/>
        <div ng-show="uploadForm.inputFile.$dirty && uploadForm.inputFile.$invalid" 
        ng-messages="uploadForm.inputFile.$error" ng-messages-include="fileUpload-messages"></div></div>
        <div class="modal-footer"><button ng-class="{'button-style': uploadForm.$valid}" ng-disabled="uploadForm.$valid || !file" ng-click="upload(file);">Upload</button></div>

This the piece of code i am trying with to disable upload button when no file is selected. It fails to work.

1 Answer 1

1

You should have the default for the button be disabled. Then create a listener for the selection. Then, once the listener is enabled and something is selected, you should change the button property to "Enabled".

Sign up to request clarification or add additional context in comments.

1 Comment

Ng-disabled is something I would look into...Matt is correct and that's how you should handle it but ng-disable is more appropriate in angular

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.