I have set the base ref like this for an Angular 2 app
If I go to localhost/MyApp everything works correctly.
I tried Parth way, but I couldn't find a way to fix my problem with the LocationStrategy
approach.
Based on some ideas from this question and ended up with something like this:
import { DefaultUrlSerializer, UrlTree } from "@angular/router";
export class LowercaseUrlSerializer extends DefaultUrlSerializer {
parse(url: string): UrlTree {
let urlUpperBaseUrl = url;
if (url.startsWith("/app")) {
urlUpperBaseUrl = "/APP" + url.slice(4);
}
if (url.startsWith("app")) {
urlUpperBaseUrl = "APP" + url.slice(3);
}
return super.parse(urlUpperBaseUrl);
}
}
You have to configure the injector as well:
@NgModule({
...
providers: [
...
{ provide: UrlSerializer, useClass: LowercaseUrlSerializer },
],
...
})
export class AppModule {
}
I hope it hepls!