Image for post: Deploy Angular apps in a shared hosting

Deploy Angular apps in a shared hosting

If you haven't any particular dependencies you can easily deploy your Angular app in a shared hosting using the amazing Ng Cli.
Simply run:

ng build --prod

If you haven't any error, this command will build your app and create a dist directory. In this directory, you will find the result of your app with static files.
Open the index,html file and remove this line if your project will not be placed in the root directory of your hosting
The --prod option optimize the application, compile and transpile the typescript code in more lightweight js files and assets.:

<base href="/">

Done! Just copy the files on your hosting and your index.html must be able to load the application. If you are using Firebase for example or you are reading some json file, be sure this functionality will work because some path may change when the app is online. Otherwise all must be ok. I hope this will be useful. Happy coding!