How i can retrieve my url value in the reactive form ? I dont know how to extract value from Observable to be returned by function in which Observable is present. I need just a value from it to be returned, nothing else.
uploadFile(event) {
const file = event.target.files[0];
const filePath = Date.now().toString();
const fileRef = this.storage.ref('/referentiels/' + filePath);
const task = this.storage.upload('/referentiels/' + filePath, file);
this.uploadPercent = task.percentageChanges();
task.snapshotChanges().pipe(
finalize(() => {
this.downloadURL = fileRef.getDownloadURL();
this.downloadURL.subscribe((url) => {
return url
});
}))
.subscribe()
}
onSaveReferentiel() {
const nomSS = this.referentielForm.get('nomSS').value;
const speSS = this.referentielForm.get('speSS').value;
const webSS = this.referentielForm.get('webSS').value;
const newReferentiel = new Referentiel (nomSS, speSS, webSS, ---url---);
this.referentielsService.createNewReferentiel(newReferentiel);
this.router.navigate(['/referentiels']);
}