Hash location strategy in angular4 app
13:21 14 Sep 2017

I started working on angular4 app and I am using hash location strategy in that app. I am able to introduce hash location strategy and its working completely fine.

My question is: there is any way to adjust the position of hash in the url?

For example: My routing module is:

[
  {path: '', redirectTo: 'parent', pathMatch: 'full'},
  { path: 'parent',
    children: [
      { path: '', redirectTo: 'upload', pathMatch: 'full' },
      { path: 'upload', component: UploaderComponent },
      {path: 'dashboard', component: DashboardComponent},
    ]
  }
]

And I am registering these routes as:

RouterModule.forRoot(routes, { useHash: true });

When I loads my app, url comes out as:

http://localhost:4200/#/parent/upload

But, is there any way to make my route as:

http://localhost:4200/parent/#/upload

I was looking into the official doc for angular-routing, but was not able to find out any way to achieve this.

Any useful suggestion to achieve this will be appreciated!!

Thanks!

angular angular-router