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!
Package.json
App.module.ts
Home.html
Home.ts
Inside app.module.ts add below:
Then import as below:
Inside home.ts use as below:
My Ionic info:
I had this error in my Angular application. It turns out my auto-import imported
AngularFirebase
from 'angularfire2/database-deprecated
'. Clearing the-deprecated
solved my issue. You might want to check your imports too.Add it in providers array in app.module.ts -
AngularDatabase
(same for AngularAuth) is separated to its own moduleAngularFireDatabaseModule
(AngularFireAuthModule for AngularAuth) from version angularFire2@4.0.0, see documentation here.you should import
AngularFireDatabaseModule
(AngularFireAuthModule for Authentication) in yourRootModule
.Make sure FireBaseDatabaseModule is imported from angularfire2/database-deprecated if youre using FireBaseDatabase from angularfire2/database-deprecated
and vice-versa. The only problem is the mismatch of import statements because they need to belong to the same package either
angularfire2/database or angularfire2/database-deprecated
if you would try to import the database from the first and the module from the second package or vice-versa. It wont recognize it as a DatabaseModule or Database.
------------ ROOT MODULE -------------
------- SERVICE CLASS ------------