'How can Angular router navigate to url which has '#' inside path?

I have this route defined in my router:

const routes: Routes = [
    {
        path: '',
        component: BaseComponent
    },
    {
        path: '#HomePage',
        component: HomePageComponent
    }
];

I'm trying to navigate to it by btn click:

this.router.navigate(['/#HomePage']);

I'm getting decoded value for "#" and url in browser is looking like this:

/%23HomePage

I need to has #. How can I do that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source