0
votes
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout';
import { AngularFireModule } from 'angularfire2'
import { AngularFireAuthModule } from 'angularfire2/auth';
import { AngularFirestoreModule } from 'angularfire2/firestore';
import { environment } from '../../environments/environment';
import { MatButtonModule, MatCheckboxModule, MatInputModule } from '@angular/material';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { LoginRoutingModule } from './login-routing.module';
import { LoginComponent } from './login.component';


@NgModule({
    imports: [
        CommonModule,
        LoginRoutingModule,
        MatInputModule,
        MatCheckboxModule,
        MatButtonModule,
        FlexLayoutModule,
        FormsModule, 
        ReactiveFormsModule,
        AngularFireModule.initializeApp(environment.firebase),
        AngularFirestoreModule,
        AngularFireAuthModule, 
    ],
    declarations: [LoginComponent]
})

export class LoginModule {}

above is the code which for my login module it throw a error on the console no default app is initialised

FirebaseError {code: "app/no-app", message: "Firebase: No Firebase App '[DEFAULT]' has been cre…- call Firebase App.initializeApp() (app/no-app).", name: "[DEFAULT]", stack: "[DEFAULT]: Firebase: No Firebase App '[DEFAULT]' h…ontext (http://localhost:4200/vendor.js:56563:25)"}

How to solve it?

1

1 Answers

0
votes

As per the docs, you need to initialize the AngularfireModule() app wide, i.e. in the app.module.ts. And the you can define which module you want to import in the submodules.

Add these in app.module.ts and remove these from login.module.ts

AngularFireModule.initializeApp(environment.firebase),
AngularFirestoreModule,
AngularFireAuthModule, 

Please refer to the official docs.