I am trying to access firebase.storage() on my project, with:
- "@angular": "2.0.0-rc.5"
- "angularfire2": "^2.0.0-beta.3-pre2"
- "firebase": "^3.3.0"
I found this solution, and created my .component.ts file with:
import { Component } from '@angular/core';
declare var firebase : any;
@Component({
template: '<img [src]="image">'
})
export class RecipesComponent {
image: string;
constructor() {
const storageRef = firebase.storage().ref().child('images/image.png');
storageRef.getDownloadURL().then(url => this.image = url);
}
}
and I get the following error in the browser console:
EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error in ./bstorageComponent class FBStorageComponent_Host - inline template:0:0
ORIGINAL EXCEPTION: Error: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp().
ORIGINAL STACKTRACE:
Error: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp().
but, I initialised firebase in app.module.ts with this import
AngularFireModule.initializeApp(firebaseConfig)
I'm not getting what I'm missing. How can I access storage using firebase? I have no problem with accessing database with angularfire2.
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…