Multiple File Select $event Object Getting Cleared from Memory #1223
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
File list in $event object is getting cleared from memory while still in use
onFileSelected event of the ng2FileSelect directive when the "multiple" attribute is used.
Steps to reproduce:
Desired behavior:
FileList object shows (details collapsed) in console.
Expand FileList object in console, individual Files should show in console, length property should reflect number of files
Observed behavior:
FileList object shows (details collapsed) in console.
Expand FileList object in console, no Files exist in the FileList object. Length property is 0.
Why is this happening?:
On this line the html input "value" property is being cleared before the async .emit() event has finished what it needs to do which is causing the files in the FileList to get cleared from memory before the event handler code has finished using it.
Possible fix idea:
Make deep copy of "files" variable in the onChange() event and emit that instead.