Hosting an Angular website on Firebase is a straightforward process. Here are the steps you can follow to host your Angular website on Firebase:
- Sign in to your Firebase account and create a new project.
- Install the Firebase CLI by running the following command in your terminal:
npm install -g firebase-tools
- Build your Angular application using the ng build command:
ng build –configuration=production
This command will create a dist folder containing all the files needed to run your Angular application.
- Use the Firebase CLI to initialize hosting for your project:
firebase init hosting
Follow the prompts to select your Firebase project and configure your hosting settings.
- Deploy your Angular application to Firebase hosting:
firebase deploy
This command will upload the contents of your dist folder to Firebase hosting and make your website available to the public.
That’s it! Your Angular website is now hosted on Firebase. You can access it by visiting the URL provided in the Firebase console. You can also customize your hosting settings, such as adding a custom domain or enabling HTTPS, by editing your Firebase hosting configuration in the Firebase console.