1

I am new to Angular(1 or 2). I have built a small application using Angular-cli and running on NodeJs. But my production env is using Tomcat. Is there a way to do it without making lots of changes in my project?

2 Answers 2

2

Yes, Angular project is just JavaScript/TypeScript and HTML. You can deploy it on any web server by simply coping the files. Or you can use something like WebPack to minify/bundle everything into single JavaScript and HTML files, and copy that to your web server.

Sign up to request clarification or add additional context in comments.

14 Comments

This is not true if you are using the angular router, which seems to only run under NodeJs at this time. Correct me if I am wrong. It is a big problem for me.
I don't think that is true. I'm using RC1 currently (using the now deprecated router) and I've tested the new router in RC4 running under IIS and it works fine.
I have a menu with [routerLink] in HTML A tags. When I run it from "npm start", it all loads and works fine, usually showing "localhost:3000" in the browser address bar. When I try to access the application from a browser without running it from "npm start", the page stops being generated at the point where it encounters the [routerLink].
That could be caused by tons of other issues, not Node vs. Tomact. It's hard to troubleshoot without seeing your app.
Thanks Boyan for quick reply. So here is what I did: I created dynamic web project in eclipse, copied app and vendor folders into WebContent folder, copied index.html, main.js, main.js.map, system-config.js, sys-config.js.map into WebContent dir also. my web.xml has index.html. I tried to launch it on Tomcat 8. it is only displaying "Loading..". It is not recognizing <my_app></my_app> tag and thus not loading what is in the my_app.component.js. Am I missing anything here?
|
0

I see many people asking for the answer. Here are the steps which are working now.

  1. Create your project using CLI.
  2. Once you have working project, go to your project folder in command window and build using ng build --prod
  3. All your built files will be in dist folder.
  4. Copy all the files from dist folder to the webapps folder of Tomcat. This is the most important step. Without this you will only see "Loading..."
  5. In index.html, change <base href="/"> to <base href=".">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.