Member-only story
Adding Firebase to an Angular project using AngularFire.
Setting up the Firebase configuration in Ionic/Angular projects.
My articles are open for everyone; non-member readers can read the article by clicking this Friend link.
First of all, we will need to create a Firebase project. We have already done this when we deployed our PWA app to firebase. Follow step #4 in the link to create a Firebase project.
# Next to install the dependencies, to do this in our project root directory run this command:
sudo npm install firebase @angular/fire --save
( put sudo
to execute this command as administrator - for Mac/Linux users and for Windows users → search Command Prompt → right click and then click ‘Run as administrator’ |sudo
is not required for Windows users )
npm install firebase @angular/fire --save] in your terminal/command-prompt
# Next we need to setup the firebase configuration in our Angular environment files. To add firebase configuration details open-up your environment file:
(for local)
YOUR-PROJECT-DIRECTORY/src/environments/environment.ts(for production)
YOUR-PROJECT-DIRECTORY/src/environments/environment.prod.ts