Reputation: 79
i'm new at angular 4.6, my Question is about how to run angular 4 application using Apache-tomcat server.
Upvotes: 2
Views: 3609
Reputation: 7688
If you are using Angular CLI, you need to use
ng build --bh /appName/
If you are deploying for production, use --prod
. When you use production parameter to build, angular uses production configurations like AOT.
for ref you can follow angular cli docs.
Upvotes: 1
Reputation: 855
Build project like: ng build --prod --aot *AOT is ahead of time compilation in angular.
Then in index.html in dist folder change href="/" to "./".
Then copy all the files to a folder(YOUR_APP_NAME) inside webapps folder and you are good to go.
Also, you can create your web.xml file inside WEB_INF directory for your application specific settings like errors, accessibility etc.
Upvotes: 1
Reputation: 2166
Go to our app and run below command.
ng build --base-href=/angular/
http://www.thejavageek.com/2018/01/04/deploying-angular-app-tomcat/
Hope this will help you!
Upvotes: 2