when i import AngularFireModule then error comes

Viewed 132

when i import AngularFireModule And initializeapp to environment.firebaseConfig then some errors are occures i can not solve that problem please tell me what i should do.

@NgModule({
  declarations: [
    AppComponent,
    HeadComponent,
    MainComponent,
    FooterComponent,
    RegistrationComponent,
    InformationComponent,
    AngularFireModule.initializeApp(environment.firebaseConfig) ,// here error comes
    AngularFireDatabaseModule
  ],

i also i already install firebase and @angular/fire

And the error look like

ERROR in src/app/app.module.ts:27:5 - error TS2322: Type 'ModuleWithProviders' is not assignable to type 'any[] | Type'. Type 'ModuleWithProviders' is missing the following properties from type 'Type': apply, call, bind, prototype, and 5 more.

27     AngularFireModule.initializeApp(environment.firebaseConfig) ,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


                  
1 Answers
  1. declarations is save components, pipes or directives.
  2. imports is saving modules.

So AngularFireModule.initializeApp(environment.firebaseConfig), should be under imports as follows.

  declarations: [
    AppComponent,
    FilterComponent,
    SearchResultsComponent,
    HeaderComponent,
    FooterComponent
  ],
  imports: [
    AngularFireModule.initializeApp(environment.firebaseConfig),
    BrowserModule,
    AppRoutingModule
  ],
Related