Deploying an Angular application
If you already have a web server that you want to use for your Angular application, you can copy the contents of the output folder to a path in that server. If you want to deploy it in another directory other than the root one, you can change the href
attribute of the <base>
tag in the main HTML file in the following ways:
- Passing the
--base-href
option in theng build
command:
ng build --base-href=/mypath/
- Setting the
baseHref
property in thebuild
command of theangular.json
file:
"options": {
"outputPath": "dist/my-app",
"index": "src/index.html",
"main": "src/main.ts",
"baseHref": "/mypath/",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles"...