Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No provider for AngularFireDatabase, AngularFireAuth

Apologies as I can't think of a better way of including all the information... When I run this, I get an error saying the following. I've followed the Ionic Docs to the T, I can't figure out what could possibly be wrong.

Error:

No provider for AngularFireDatabase!

Error

Package.json Package

App.module.ts App.Module

Home.html Home HTML

Home.ts Home TS

like image 483
Slabach Avatar asked May 04 '17 01:05

Slabach


1 Answers

AngularDatabase(same for AngularAuth) is separated to its own module AngularFireDatabaseModule(AngularFireAuthModule for AngularAuth) from version [email protected], see documentation here.

you should import AngularFireDatabaseModule(AngularFireAuthModule for Authentication) in your RootModule.

import { AngularFireModule } from 'angularfire2'; // for AngularFireDatabase import { AngularFireDatabaseModule } from 'angularfire2/database'; import { AngularFireDatabase, FirebaseObjectObservable } from 'angularfire2/database'; // for AngularFireAuth import { AngularFireAuthModule } from 'angularfire2/auth'; import { AngularFireAuth } from 'angularfire2/auth';  @NgModule({   imports: [     AngularFireModule.initializeApp({         <---- main module       apiKey: ...,       authDomain: '...',       databaseURL: '...',       storageBucket: '...',       messagingSenderId: '...'     }),                                            AngularFireDatabaseModule,                <---- for database      AngularFireAuthModule                     <---- for auth   ] }) 
like image 70
Pengyy Avatar answered Sep 30 '22 08:09

Pengyy