Finally the below steps as pointed in [https://stackoverflow.com/questions/38273130/how-to-deploy-an-angular-2-app-using-firebase-hosting?rq=1][1] worked for me
Step 1: Build your App
Run the below cmd to build
ng build --prod
Step 2: Create FireBase project and Install Firebase CLI
Open the Firebase console at https://console.firebase.google.com/ and create a new Firebase project.
To install the Firebase command line tools run:
npm install -g firebase-tools
Step 3: Deploy to FireBase
Run the below firebase cmd to login:
firebase login
It will open the browser and ask you for authentication. Login with your Firebase account. There after you can close the browser window. On the command line you'll receive the message that the login has been performed successfully.
Now run the below cmd:
firebase init
First of all you're being asked which of the Firebase client features you want to use. You should select the option Hosting: Configure and deploy Firebase Hosting site. Next the Firebase client will ask which folder to use for deployment. Type in dist. That is important because that is the location where our production build is stored.
Next the question is ask if this app is a single page app and if it should rewrite all URLs to index.html. In our case we need to answer yes.
Last question is if Firebase should over write file index.html. The answer to that question is no.
Now, Run the below cmd to deploy:
firebase deploy
Firebase will provide a URL which you can use to access your application online.
Do Create a project with Angular CLI first. Get More info here https://cli.angular.io/
**Step 1: Build your App**
Run the below cmd to build
ng build --prod
**Step 2: Create FireBase project and Install Firebase CLI**
Open the Firebase console at https://console.firebase.google.com/ and create a new Firebase project.
To install the Firebase command line tools run:
npm install -g firebase-tools
**Step 3: Deploy to FireBase**
Run the below firebase cmd to login:
firebase login
It will open the browser and ask you for authentication. Login with your Firebase account. There after you can close the browser window. On the command line you'll receive the message that the login has been performed successfully.
Now run the below cmd:
firebase init
First of all you're being asked which of the Firebase client features you want to use. You should select the option Hosting: Configure and deploy Firebase Hosting site. Next the Firebase client will ask which folder to use for deployment. Type in **dist**. That is important because that is the location where our production build is stored.
Next the question is ask if this app is a single page app and if it should rewrite all URLs to index.html. In our case we need to answer yes.
Last question is if Firebase should over write file index.html. The answer to that question is no.
Now, Run the below cmd to deploy:
firebase deploy
Firebase will provide a **URL** which you can use to access your application online.