Deploying an Angular app
If you already have a web server that you want to use for your shiny new Angular 10 app, simply copy the contents of the output folder to a path in your server. If you want to deploy it in another directory other than the root one, use the --base-href
option of the ng build
command:
ng build --prod --base-href=/https/www.packtpub.com/myapp/
The previous command will build the Angular app in production mode and change the href
value of the base
tag in the index.html
file to /myapp/
.
If you do not want to deploy it to a custom server, you can use the Angular CLI infrastructure to deploy it in one of the built-in hosting providers that it supports out of the box, including the following:
- Firebase hosting: https://firebase.google.com/docs/hosting
- Azure: https://azure.microsoft.com/en-us/
- Netlify: https://www.netlify.com/
- GitHub Pages: https://pages.github.com/
- Npm: https://npmjs.com/
Important Note
Before using automatic deployment, you will probably need...