I’m Going to Show How we Can Deploy Angular Application To The firebase.create Firebase Account before starting below are the steps to create firebase account.If you have a firebase Account kindly skip this section.
Creating Firebase Project.
- Go to the Firebase Website .
- signup with Google If you dont have Google Account Kindly Create one.
- After login with Google click on Go to Console Button which will appear in navigation tab after sucessfull signin.
- Click on Create a Project Button and then it will ask Project Name Enter Project Name and Accept The Terms And Click Continue.
- Now Your Firebase Project Was Created now You Need to add web app configuration to your project.
- click on web project icon and enter web app name.accept the terms click continue.
- Now your firebase project is ready.
Creating Angular Project.
If You Have Already Have Angular Project and You are Looking for only deployment kindly skip this step.
- If you don’t have nodejs installed in your local pc kindly install using this Link.
- Once Nodejs Installed in your Machine open command prompt type the command “node -v” press enter you will see node version printed if not then there is problem with your installation.
- After installing nodejs Application kindly run the command “npm install -g @angular/cli” it will install angular command line interface to your pc .
- Now it’s time to create angular project open command prompt and type the command “ng new <Project name>“
- Now your Project is sucessfully created.
Time To Deploy Angular Project to firebase.
- Run command “ng build — prod” inside project Folder.
- It will Create production build inside dist folder.
- Now Angular related to stuff was completed lets jump to firebase.
- First you need install firebase cli in your pc for that run this command in your command prompt “npm i -g firebase-tools”.
- Above command will install firebase tools globally in your pc.
- Now you need to login with firebase run firebase command “firebase login” in cmd it will redirect to browser and login with google account in which we have created firebase account previously.
- After sucessfull login open command prompt inside angular project folder and run the command “firebase init” it will list firebase feature in cmd select “Hosting: Configure and deploy Firebase Hosting sites” by pressing space bar from the keyboard.
- It will ask the project to be selected for hosting select the project name that we have created previously and press enter.
- It will ask the production build folder by default it was selected as “public” you need to type “dist” in cmd beacuse our production build located inside dist folder as we did before.
- firebase initalization was completed sucessfully its time to publish the angular project.
- inside project folder run the command “ng build — prod” if you didn’t run previously after run the command “firebase deploy” it will push build files to firebase server.
- After successfull deployment project url will be generated in cmd or you can get the link by going to furebase account inside project and then selecting Hosting menu.
- Now your project successfully deployed to firebase.