2

I have the following html template:

<a [routerLink]="'/views/' + typeParam + '/my-recently-updated'" routerLinkActive="active">some text</a>

When I click on that link I see item is selected but when I reload page (press F5) then I see no selected items.

views-routing.module.ts:

const viewsRoutes: Routes = [
    {
        path: '',
        component: ViewsComponent,
        children: [
            { path: ':type', component: ViewsWrapperComponent },
            { path: ':type/:view_name', component: ViewsWrapperComponent }
        ]
    }
];

@NgModule({
    imports: [RouterModule.forChild(viewsRoutes)],
    exports: [RouterModule]
})
export class ViewsRoutingModule { }

How can I resolve this?

A. Gladkiy
  • 3,134
  • 5
  • 38
  • 82

1 Answers1

2

I resolved it this way:

<a [routerLink]="'/views/' + typeParam + '/my-recently-updated'" 
    routerLinkActive="active"
    [routerLinkActiveOptions]="{ __change_detection_hack__: typeParam }">some text</a>

as here issue on github

A. Gladkiy
  • 3,134
  • 5
  • 38
  • 82