Angular 2 refresh issue under context path

636 views Asked by At

I'm developing an angular 2 app. I found a lot but I didn't find the right solution for my problem. So essentialy, if I run the app with "ng serve" all works fine, if I refresh the page (for example http://localhost:4200/home) it works fine. The problem occurs when I build the app in a war and deploy it on wildfly with a different context path (ex. /myapp). At this point the routing navigation works fine but if I refresh the page I receive a "Not found error". My base href on index.html is ""

1

There are 1 answers

0
Fabrizio P On

Solved using {provide: LocationStrategy, useClass: HashLocationStrategy} in app modules