I am new to Angular 2. I am confused with how Angular 2 works in production environment.
What are the prerequisites for running Angular 2 application in pr
npm install -g angular-cli")This works better if you had created the application using angular-cli instructions shown here. In your application root directory, run the following command ng build --env=prod and that will bundle, via webpack, the deployable items in the \dist directory.
Copy the \dist directory and paste it into {CATALINA_HOME}\webapps. Rename \dist to a folder name such as \foo. Open \foo\index.html and edit the base-href line to represent your new directory name:
Start Tomcat via startup.bat or your chosen preference and navigate to http://localhost:8080/foo/ and you should be able to view your Angular 2 application.
Note: If you had not created the project with ng new command, I had read where executing ng init before build will allow you to still follow the steps. I have not tested this myself though.