Skip to content

Instantly share code, notes, and snippets.

@jckeen
Created October 12, 2016 20:42
Show Gist options
  • Save jckeen/0b820591a54441f890a5d7159dc05ab4 to your computer and use it in GitHub Desktop.
Save jckeen/0b820591a54441f890a5d7159dc05ab4 to your computer and use it in GitHub Desktop.
Access Firebase SDK from instance created by AngularFire2
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