Angular 6 - Getting Download URL For Firebase Storage File After Uploading


Answer :

You should add a finalize() to the pipe, something like:

this.task.snapshotChanges().pipe(   finalize(() => {     this.downloadURL = this.ref.getDownloadURL(); // <-- Here the downloadURL is available.   }) ).subscribe(); 

In the finalize() step, the downloadURL is available, so u can grab him from the ref asynchronously. --UPDATE
You said you are using Angular 6, so I assume you are using the last version of firebase.
They change getDownloadURL() to Observable from Task, So to get the actual URL you just have to subscribe.

this.task.snapshotChanges().pipe(   finalize(() => {     this.ref.getDownloadURL().subscribe(url => {       console.log(url); // <-- do what ever you want with the url..     });   }) ).subscribe(); 

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?