I have created n new angular app using angular-cli.
I completed the app and preview it using ng-serve, it is working perfectly.
After that I used ng build --
Use ng build with the --bh flag
ng build
--bh
Sets base tag href to /myUrl/ in your index.html:
ng build --base-href /myUrl/ ng build --bh /myUrl/