angular firebase
npm install firebase @angular/fire
angular firebase
npm install firebase @angular/fire
angular firebase
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
// 1. Import the libs you need
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireStorageModule } from '@angular/fire/storage';
import { AngularFireAuthModule } from '@angular/fire/auth';
// 2. Add your credentials from step 1
const config = {
apiKey: '<your-key>',
authDomain: '<your-project-authdomain>',
databaseURL: '<your-database-URL>',
projectId: '<your-project-id>',
storageBucket: '<your-storage-bucket>',
messagingSenderId: '<your-messaging-sender-id>'
};
@NgModule({
imports: [
BrowserModule,
// 3. Initialize
AngularFireModule.initializeApp(config),
AngularFirestoreModule, // firestore
AngularFireAuthModule, // auth
AngularFireStorageModule // storage
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule {}
angular firebase
import { AngularFirestore } from '@angular/fire/firestore';
@Component(...)
export class SomeComponent {
constructor(private db: AngularFirestore) {
const things = db.collection('things').valueChanges();
things.subscribe(console.log);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us