ng-provide-firebase
v16.0.1
Published
Angular Firebase App Provider =============================
Downloads
5
Readme
Angular Firebase App Provider
This is a simple function that provides a Firebase app to Angular dependency injection.
Configuring Firebase
// src/app/app.module.ts
@NgModule({
declarations: [
AppComponent
],
imports: [
//...
],
providers: [
provideFirebase({
apiKey: "#####",
authDomain: "#####",
projectId: "#####",
storageBucket: "#####",
messagingSenderId: "#####",
appId: "#####",
measurementId: "#####"
})
],
bootstrap: [AppComponent]
})
export class AppModule { }
Using your Firebase app
// src/app/app.component.ts
import { Component } from '@angular/core';
import {Firebase} from 'ng-provide-firebase';
import {getFirestore} from 'firebase/firestore';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
private db = getFirestore(this.firebase);
constructor(private firebase: Firebase) {
// todo do something cool with your Firestore DB
}
}