Skip to content

How to remove # from URL? #55

Answered by ThoSap
monu asked this question in PrimeNG Templates
Sep 16, 2023 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Hi @monu,

you have to change the Angular LocationStrategy in file src/app/app.module.ts#L275 ([email protected]) from

        {provide: LocationStrategy, useClass: HashLocationStrategy},

to

        {provide: LocationStrategy, useClass: PathLocationStrategy},

and change the import src/app/app.module.ts#6 from

import {HashLocationStrategy, LocationStrategy} from '@angular/common';

to

import {LocationStrategy, PathLocationStrategy} from '@angular/common';

I hope this helps 👌

The PathLocationStrategy is the default in Angular, maybe the PrimeNG premium templates should change to that and also move to standalone components @cagataycivici
https://angular.io/guide/router#locationstrategy-and-brow…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@monu
Comment options

Answer selected by monu
Comment options

You must be logged in to vote
1 reply
@ThoSap
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants