angular-file-model
angular-file-model copied to clipboard
Unable to reset file
I am trying to allow the user to remove the selected file and re-select another one. This will work fine, unless the user selects the same file as previous. Then nothing seems to happen. The on-read-file
doesn't seem to get triggered if the file is the same as before. I am setting $scope.file = null;
but this has no effect.
Is there something else I need to be doing to reset the file?
Hey! I really have no idea what would be going wrong; honestly have too much time without doing anything on angular. Sorry.
did you find any solution??
Had to go with the ol' angular hard-wipe of removing/adding back to the dom to do a full clear out.
<input ng-if="vm.ready" type="file" id="{{ vm.id }}" name="files" class="input-file" file-model="vm.file"/>
plus
vm.ready = false;
vm.file = null;
$timeout(() => {
vm.ready = true;
});
did the trick.
Hope this helps!