In app.routing.ts I have added a route with parameters
{
path: 'manager-branch/:id',
loadChildren: './components/manager/manager-branch/manager-branch.module#ManagerBranchModule'
}
Everything works fine If I browse to it through the application, however if I refresh page while being on that component, my application root url will be wrong and page will fail to load.
For instance, my application root url is http://localhost:4200
If I refresh my page while being on any other component which doesn't have routing parameter, it will work fine.
If I refresh my page while on http://localhost:4200/manager-branch/1 it will fail to load.
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4200/manager-branch/assets/css/font-awesome.min.css
You can see that app url is not correct. There shouldn't be manager-branch in it.
Here's manager.branch.module.ts
@NgModule({
imports: [
ManagerBranchRoutingModule,
CommonModule,
Ng2BootstrapModule,
ModalModule.forRoot(),
FormsModule
],
declarations: [
ManagerBranchComponent,
ManagerEmployeeComponent,
EmployeeProfileComponent,
ManagerTransactionsComponent,
EmployeeTransactionsComponent,
]
})
export class ManagerBranchModule {}
The problem is in my app.module.ts
useClass: PathLocationStrategy
it works fine with HashLocationStrategy, but I have to stick with Path