Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use /dist folder files created by angular-cli ng build command to create an app that can be run by itself?

In order to see the ng build result, I need to run ng serve, but how that helps me to create an angular2 project that I can run in any web hosting? my web hosting don't know angular2 or ng serve command. What did I miss in this process?

Please advise how after using angular-cli (which is a great tool) I'm now ready to updload files to any web hosting and see my app running. I thought if I run the "index.html" file I get app that runs and not depeneding on any commands :-/

This is the resuilt of index.html: enter image description here

like image 779
AngularOne Avatar asked Jan 05 '23 12:01

AngularOne


1 Answers

ng serve : in memory (local) development ng build : creates a distributable stand-alone app in your dist folder.

So run a ng build and copy the contents of the dist folder to any remote server and it should run (need to run it in the root btw, if you want to run your app in a subfolder on your remote server, do a ng build --base-href myapp --prod)

like image 63
MikeOne Avatar answered May 15 '23 09:05

MikeOne