How to Register for / Listen to upload complete events #251
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?
Hi
I would like to use this component but I am struggling to see how to register to listen for the onComplete or onSuccess events.
It appears that the file-drop.directive is emitting events using the Angular2 EventEmitter which should be ok to listen for. However the file-uploader.class component is not doing this and its not clear to me how we can listen for a successful/ failed upload and react accordingly.
I may be missing something obvious so perhaps a quick explanation or simple example would explain.
Or should I just be using this code as a basis for my own code and extend the classes where I need to add extra functionality ?
One way that you could listen for the upload complete events is by adding the listener in the ngOnInit method of your component like this:
This means that your component needs to implement OnInit. Not sure if this is the best way though. Any other ideas?
I stumbled on this to begin with too but @simonaco is correct, you need to redefine the functions yourself, though I'm not sure why you would have to implement
OnInit. If you don't require details of the completed upload or you want to fire something off when the entire queue of files have completed you can use:+1
thx @jasonroyle . There is also a method to catch errors?
@Sispheor looks like onErrorItem is what you're after. To find the full list have a look at the file uploader class.
Thank you !
I was looking for a doc on the web site. But reading the class itself is not bad too after all :)