Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Module '"@angular/fire/firestore"' has no exported member 'AngularFirestoreModule'

import { AngularFirestoreModule } from '@angular/fire/firestore' ; // => Error

Module '"@angular/fire/firestore"' has no exported member 'AngularFirestoreModule'

package.json

"@angular/fire": "^7.0.4",

like image 974
Nahrma Bozonda Avatar asked Aug 31 '26 02:08

Nahrma Bozonda


1 Answers

I encountered the same problem and in the GitHub repo (https://github.com/angular/angularfire) is explained how to adjust the code for the new version

import { Firestore, collectionData, collection } from '@angular/fire/firestore';
import { Observable } from 'rxjs';
...
item$: Observable<Item[]>;
constructor(firestore: Firestore) {
    const collection = collection(firestore, 'items');
    this.item$ = collectionData(collection);
  }

You also have to change the way you initialize the app in the app.module.ts

import { provideFirebaseApp, getApp, initializeApp } from '@angular/fire/app';
import { getFirestore, provideFirestore } from '@angular/fire/firestore';

@NgModule({
  imports: [
    provideFirebaseApp(() => initializeApp({ ... })),
    provideFirestore(() => getFirestore()),
  ],
  ...
})
like image 183
MitchAloha Avatar answered Sep 02 '26 18:09

MitchAloha