This has got to be one of the most simplest Angular questions there is, but alas, I've search high and low and still cannot get the "required" $error to switch.
I've looked at this Stackoverflow Question but I'm already using valid-file
Here's my file input code:
<input name="eulaAssetFile"
style="vertical-align: middle;"
type="file"
id="eulaAssetFileIdRegular" ng-model="eulaAssetFile"
ng-multiple="false" accept=".rtf"
class="form-control valid-file"
required />
<div class="delete-button pull-right" ng-show="!!dummy.docs" ng-repeat="docs in dummy.docs">
{{assetAddEulaForm.eulaAssetFile}}
<button class="glyphicon glyphicon-remove text-danger" ng-click="dummy.docs = null"></button>
</div>
<br />
<!-- This is the error message -->
<p class="help-block" ng-if="assetAddEulaForm.$invalid">Please select a doc file to upload.</p>
Also, as you can see, I'm attempting to "list" the file being uploaded and give the user to ability to "remove" that file.
What's happening, is in the Stackoverflow question link above, the .directive for validFile is never being hit.
I'm also using an show-errors message from Paul Yoder but there's no example of using an input type=file.
So here's what I'm trying to accomplish:
- The user clicks the "SUBMIT" button and the error shows - It does and it's fine
- The user selects a file (since the input is REQUIRED) and the error is "supposed" to go away and it doesn't, thus, the form and field still show "$error { eulaAssetFile: required } rendering the form $invalid. That's the problem I need to fix.
Any help with this would be appreciated.