Angular 6 - Getting download URL for Firebase Storage file after uploading
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();