Created
October 12, 2016 20:42
-
-
Save jckeen/0b820591a54441f890a5d7159dc05ab4 to your computer and use it in GitHub Desktop.
Access Firebase SDK from instance created by AngularFire2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FirebaseApp } from 'angularfire2'; | |
import { Injectable, Inject } from '@angular/core'; | |
/** | |
* After importing AngularFire2 with AngularFireModule.initializeApp(firebaseConfig), | |
* you can use this to access that instance that was created with your configuration | |
*/ | |
@Injectable() | |
export class FirebaseService { | |
public authRef: any; | |
public storageRef: any; | |
public databaseRef: any; | |
constructor(@Inject(FirebaseApp) firebase: any) { | |
this.authRef = firebase.auth(); | |
this.storageRef = firebase.storage(); | |
this.databaseRef = firebase.database(); | |
} | |
fetchProvidersForEmail(email: string) { | |
return this.authRef.fetchProvidersForEmail(email); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment