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?

2
  • Can u put your router module in question ? Commented May 19, 2020 at 9:15
  • @pc_coder ready Commented May 19, 2020 at 9:27

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.