I am trying to use the freshly introduced Firestore emulator in my Angular7 application.
According to this documentation, I run the dev server on 127.0.0.1:8080
with :
firebase serve --only firestore
Then, after ng serve
, how can I make my AngularFire module use the database emulator ?
I tried the following in my environment.ts
:
export const environment = {
production: false,
name: 'local',
firebase: {
databaseURL: "http://127.0.0.1:8080"
}
};
But it does not work since it needs a "projectId". I tried to set it to my pre-production Firestore database, but then the dev server is not used.
Any thought about it ?
Here is my app.module.ts
:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from '@app/app-routing.module';
import { AppComponent } from '@app/app.component';
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireStorageModule } from '@angular/fire/storage';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { environment } from '@env/environment';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
AngularFireModule.initializeApp(environment.firebase, 'my-super-cool-app'),
AngularFirestoreModule,
AngularFireAuthModule,
AngularFireStorageModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
--only firestore
. The only valid targets arehosting
andfunctions
. As far as I now you can only servefunctions
andhosting
locally, but notfirestore
. You must use the onlinefirestore
. – Jacklight