Hi,
i'm able to serve the files with http server, ng serve. But I want to deploy to tomcat server, I ran the command ng build -prod and got the dist folder created. I need to place the dist folder content inside project folder of webapps. Let say, sampleapp is my project folder, I copied all the contents ,generated in dist folder to sampleapp folder. When i access the application in getting lot of 404 error(
http://localhost:8080/vendor/systemjs/dist/system.src.js). It seems Angular is looking in root direectory. How can i customize the build to read it from my project directory?
like
http://localhost:8080/sampleapp/vendor/systemjs/dist/system.src.js
I tried editing the index.html tag , and then built. No luck
Which file I have to look out for the ng-build command. Please help me out in finding the solution
@hareeshav I got the same error.
My static webapp (angular2) is deploy in tomcat under http://localhost:8080/myapp
You need to change in index.html
<base href="/">
to
<base href=".">
All angular.io documentation assume that you will deploy your apps under ROOT http://localhost:8080/ (usually the case with virtual host but not the commons case in tomcat / java world)
@wardbell It would be nice if a warning could be added in the following docs pages ;)
https://angular.io/docs/ts/latest/tutorial/toh-pt5.html#!#add-routing
https://angular.io/docs/ts/latest/guide/router.html#!#base-href
This deployment issue isn't specific to the CLI so I am closing. But I'd like to say that we have an issue open to add the base tag override https://github.com/angular/angular-cli/issues/1064
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
@hareeshav I got the same error.
My static webapp (angular2) is deploy in tomcat under http://localhost:8080/myapp
You need to change in
index.html
<base href="/">
to
<base href=".">
All angular.io documentation assume that you will deploy your apps under ROOT http://localhost:8080/ (usually the case with virtual host but not the commons case in tomcat / java world)
@wardbell It would be nice if a warning could be added in the following docs pages ;)
https://angular.io/docs/ts/latest/tutorial/toh-pt5.html#!#add-routing
https://angular.io/docs/ts/latest/guide/router.html#!#base-href