1

I used ng add @angular/fire to add firebase to ionic angular 7 project. When I checked the package.json file I found only @angular/fire without firebase package and rxfire package. Also creating the ionic app generated standalone version of angular without the app.module.ts

Now I know that I need to add the providers in the component in the imports like

provideFirebaseApp(() => initializeApp(environment.firebase)),
provideFirestore(() => getFirestore())

but I need to know in which component

  • Looking for the answer as well – Moblize IT Apr 05 '23 at 03:26
  • See. I did something that worked very well. first install ionic using the normal way through documentation. second install ng add @angular/fire third create new angular project ng new my-app forth install ng add @ionic/angular fifth copy the app.module and app-routing.module into your project sixth remove the standalone property from the default created component (home.Page) and update it in the app-routing.module seventh copy the code from main.ts to main.ts in your project (you are copying from the regular angular installation project to the ionic project) I tested the procedures – Xyz.WebDeveloper Apr 05 '23 at 03:36
  • I forget something. In the sixth procedure, remove module imports from default component (home.Page) as well (keep module imports in app.module) note: when you make the other project install firebase on it using nd add @angular/fire and it will do all the imports for you in app.module – Xyz.WebDeveloper Apr 05 '23 at 03:41

1 Answers1

0

The most reasonable is create app.module.ts and run ng add @angular/fire, after the wizard is finish, insert AppModule into import section in every component need firebase.

Yoshua D
  • 1
  • 1