I am prompting for a file name in an ng-repeat
loop:
<tr ng-repeat="candidate in candidates.details">
<td style="text-align:left"><input type="text" ng-model="candidate.name" placeholder="Candidate's name" autofocus ng-change="CandiateNameOrDescriptionChanged()" /></td>
==> <td style="text-align:left"><input type="file" accept=".doc,.docx,.pdf" id="csvFileSelector" file-change handler="CvSelected(candidate, files)"></td>
<td style="text-align:left"><textarea ng-model="candidate.description" placeholder="Descriptive text" ng-change="CandiateNameOrDescriptionChanged()" ></textarea></td>
<td style="text-align:left"><button type="button" class="btn btn-outline btn-success" style="margin-left:10%" ng-disabled="candidate.name=='' || candidate.cv==''" ng-click="DeleteCandidate($event, candidate)">Delete</button></td>
<td> </td>
</tr>
My AngularJs handler for file selection checks for file extension being doc, docx or pdf and, if not, shows an alert.
I would also like it to reset the selected file name, showing it as blank.
This question shows how to do it, but it clears all input file names.
How can I clear only the one with the invalid extension (it is always the last)?
I am thinking of adding an element Id, based on some loop index (unless I can directly address the last such input), but am unsure of quite how to go about it.