angular-file-model icon indicating copy to clipboard operation
angular-file-model copied to clipboard

Unable to reset file

Open RipleWare opened this issue 8 years ago • 3 comments

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?

RipleWare avatar Aug 12 '16 02:08 RipleWare

Hey! I really have no idea what would be going wrong; honestly have too much time without doing anything on angular. Sorry.

ghostbar avatar Aug 15 '16 17:08 ghostbar

did you find any solution??

omar1893 avatar Apr 17 '17 14:04 omar1893

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!

NateVonSmith avatar Oct 26 '17 18:10 NateVonSmith