No provider for AngularFireDatabase

I do not know the error

import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';

import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { UsuarioService } from '../providers/usuario/usuario';
// firebase
import {AngularFireModule} from 'angularfire2';
export const config={
      apiKey: "AIzaSyArwGg8FfERure5UzpqB7tRqeehiyBOVjY",
    authDomain: "tracker-d2863.firebaseapp.com",
    databaseURL: "https://tracker-d2863.firebaseio.com",
    projectId: "tracker-d2863",
    storageBucket: "tracker-d2863.appspot.com",
    messagingSenderId: "118251126046"

};



@NgModule({
  declarations: [
    MyApp,
    HomePage,
  
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp),
    AngularFireModule.initializeApp(config)

    
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage,
    
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    UsuarioService
  ]
})
export class AppModule {}

usuario.ts

import { Injectable } from '@angular/core';
import { AngularFireDatabase } from 'angularfire2/database';

@Injectable()
export class UsuarioService {

constructor(private af: AngularFireDatabase) {
  
}

verifica_usuario(clave:string){
  clave = clave.toLowerCase();

  let promesa = new Promise ((resolve, reject)=>{
    this.af.list('/usuarios'+clave).subscribe(data=>{
      console.log(data);

      resolve();
    })

  });
  return promesa;
}
}

Runtime Error
UPreformatted textncaught (in promise): Error: No provider for AngularFireDatabase! Error: No provider for AngularFireDatabase! at injectionError

Post the actual error as text so it is searchable, and update the thread topic to include it. The current topic conveys zero useful information. You probably want to redact your Firebase API key as well.

23/5000
No, it’s okay api key apiKey: "AIzaSyArwGg8FfERure5UzpqB7tRqeehiyBOVjY",

You are missing AngularFireDatabaseModule, as is documented here.

Well, I’m already looking at it, is this guide no longer useful?

I stopped reading after the second sentence when it told us to run npm with superuser privileges. I think that’s irresponsible.

thank you very much:+1:

please help me …am not able to solve above error

Seems like you have the same problem that the first person in this thread. I suggest reading it with patience.
Also, please avoid posting text error messages as images, that’s not helpful.
Best regards,
JS

1 Like