This problem is solved by implementing HashLocationStrategy which adds # to all your routes. You achieve this by adding HashLocationStrategy to AppModule providers.
providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}],
and add the corresponding import
import { HashLocationStrategy, LocationStrategy } from '@angular/common';
This will solve your problem.
And if you don’t want to use the HashLocationStrategy, you can use the PathLocationStrategy, and so your Angular app will not show Hash in the URL.