Angular - Migrate from HashLocationStrategy to PathLocationStrategy Maintaining Bookmarks

Viewed 36

Currently I am working on migrating us from HashLocationStrategy to PathLocationStrategy and I am running into an issue with a requirement I have: "Existing bookmarked URLs must still work". But when I change the location strategy over here's what happens:

Before:

localhost:4200/#/admin

After:

localhost:4200/admin

Bookmarked saved as "localhost:4200/#/admin" clicked:

localhost:4200/home#/admin

Is there any way to just have this understand that the /#/ is just to be ignored now? I was hoping that Angular would naturally route away from the hash, but sadly it doesn't seem to be doing what I expected.

Currently the only thing I changed is adding this in place of "HashLocationStrategy" in app.module.ts:

{ provide: LocationStrategy, useClass: PathLocationStrategy },

Let me know if there's any more information needed and I'll add it!

0 Answers
Related