Reputation: 157
I have category drop down, Based on category i want to update menus router link. Lets consider I have selected Category1 then SubMenu1 router link should be BASE/category1/submenu1. same way for category 2 router link should be BASE/category2/submenu1
I tried to achieve this using string interpolation like BASE/{{category}}/submenu1 and tried to setting category from .ts on drop down change. But it doesn't work.
We thought we use on click of respective submenu and access the drop down value and then navigate but when i hover over submenu it doesn't show proper link which is not good thats why i wanted to update submenu link on category dropdown change.
Thanks in advance.
Upvotes: -2
Views: 695
Reputation: 28464
The suggested approach to merge static with non static data is to use the link parameters array. For example:
<a [routerLink]="[category,'submenu1']">Some link</a>
For more info please check the official docs
Upvotes: 1
Reputation: 2784
use routerLink
like that:
<li [routerLink]=['/BASE', category1, submenu1]></li>
More Information about routerLink
: here
Upvotes: 1