I’m a big fan of the Angular CLI, it makes working with Angular a lot easier and guarantees a level of consistenty between all team members. But I noticed that some people get into trouble the moment they try to host their application in IIS.
Most of the time you don’t host your Angular app directly under the Default Website, instead you add a virtual application and host your files in it.
Problem is that if you just do an ‘ng build’ and copy the dist folder to your target directory, it will probably not work. When you browse to the URI, you only get a ‘loading…’ message and nothing seems to happen.
Inside the console, you see that the Angular application tries to load all your bundles from ‘http://localhost’ instead of ‘http://localhost/sampleapp’:
To fix this you have to specify some extra parameters when building your Angular app for distribution:
ng build --deploy-url "/sampleapp" --base-href="/sampleapp"
That should do the trick…