I\'m new in AngularJS 2 framework and I\'m stuck!
I want to deploy an application (quickstart for example) on a Windows Server 2012. I have already installed Apache
If your are using angular-cli command to create angular 2 project.Then cli has given some commands to deploy your application into production. Use command like ng build --prod on your project directory and it will generate dist folder in your directory.
Go to inside dist folder and change the base href like href="." in index.html. After that copy dist folder in your tomcat root directory and run the server.. you can see below screen shot our application running on tomcat server.
You can change one place in the index.html: <base href="/">
Make the base href to be your relative path form webapps folder in tomcat to the folder that includes the index.html of your angular app.
In your case, change it to: <base href="./dist">
No other changes are needed.
Just build it out using any of the build tasks(dev will include some source maps, and don't worry about having node on the server as node is only needed for the development tooling. Then just copy over all the files in the dist folder. Have a look in the index.html and make sure that the references to the various scrips are correct. The only thing the app needs to run is the scrips in the index, no node is needed.
ng build --prod
on your terminal/
from
.
in like href="."
and go to url example: http://localhost:8080/ProjectName/#/URL and check it. I've found the solution:
I had to insert the right path to the bundle files!
I changed for example the src attribut of the index file from : src="inline.bundle.js"
to : src="dist/inline.bundle.js"
Just added the DIST FOLDEEEEEER ! Haha Thank you run yards for your help !