How to host Angular application on GitHub Pages

[Last update 04-04-2017]

To install the command run the following:

npm i -g angular-cli-ghpages

Note: you have to create the dist folder in before (e.g. ng build --prod)

ng build --prod --base-href "https://USERNAME.github.io/REPOSITORY/"
ngh

In case you use a custom domain for one of your repositories (like I do for this blog), you should use http instead

ng build --prod --base-href "http://YOURDOMAIN.com/REPOSITORY/"
ngh

For more information check angular-cli-ghpages GitHub Page.

There might be a problem with routing. If so check this FAQ