useHash
should have helped, but are you sure you actually turned it on? Do you have the problem even with hash location turned on?
Since you are using the latest Angular (v19), I suspect that you are using the standalone bootstrapping API. In this case, you need to write it in a different way using withHashLocation:
bootstrapApplication(AppComponent,
{
providers: [
provideRouter(appRoutes, withHashLocation())
]
}
);