Ionic Firebase storage downloadURL


#1

Hi guys,
i have some problem with URL address to my file. I storage image in Firebase Storage.
So, i can get URL address to my filme and I can typing URL on console but i cant assign as variable. I have no idea what is wrong.

import { Component, ViewChild } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { storage } from 'firebase';
import { AngularFireAuth } from 'angularfire2/auth'



import { Camera, CameraOptions } from "@ionic-native/camera";
import { ToastController } from "ionic-angular";


@IonicPage()
@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})

export class HomePage {
  @ViewChild('myimg') myImgElement;
  bigImg = 'https://vignette.wikia.nocookie.net/nikita2010/images/d/d2/Blank.png/revision/latest/scale-to-width-down/640?cb=20130725195235'; 
  list = [];
  addr;
  name;
  email;
  currentPhotoAddress;
  assetCollection; 
  public myPhotosRef: any;


  constructor(private ofAuth:AngularFireAuth, 
    private camera: Camera,public navCtrl: NavController, public navParams: NavParams, private _tc: ToastController) {
    
  }
  async getImage(){
    var storageRef = storage().ref('dropsik03@gmail.com/Starwars2');
    var downloadedURL;
   
    storageRef.getDownloadURL().then(function(url) {
      console.log(url);
	  this.downloadedURL = url;
    });
      console.log(downloadedURL);  
  }
  async takePhotoViaGallery(){
    ...
  }
  async takePhotoViaCamera(){
	....
  }
  ionViewDidLoad() {   
    ...
  }

}

Maybe its scope problem or something?
i try use .toString(), but its nothing change.

this.downloadedURL = url.toString();

So, anyone know what is wrong? Thanks for any suggestions.

error code:


#2

could you solve it? I have the same problem