Matblazor: Feature Request: MatNavItem auto-activate based on URL like Blazor's built-in NavLink

Created on 19 Sep 2019  路  6Comments  路  Source: SamProf/MatBlazor

MatNavItem only updates its "active" state when clicked, rather than basing active state on what the current URL is, like Blazor's built in NavLink component. This means the active state is initially out of sync on first load or a reload, and becomes out of sync whenever a link is clicked outside the nav list. It should work similarly to NavLink or at least provide the option to.

Most helpful comment

Done. Not sure how to make it show up here. I am more of a lurker...

All 6 comments

@JeroMiya this was fixed in Sept. can you confirm it works for you and close this issue? Thanks.

I've had to switch gears to another project for a while but if you're confident it's been addressed you can close it yourself if you like.

@enkodellc It seems to only work for the exact match URL.

So <MatNavItem Class="sub-nav-item" href="app/users">Users</MatNavItem> lights up for http://localhost:53152/app/users but not for http://localhost:53152/app/users/user/1062

@SamProf Looks like the underlying NavLink is using NavLinkMatch.All while it probably should be using NavLinkMatch.Prefix, or better yet expose that property for users to set.

@americanslon Sounds like a great first PR for you to submit to MatBlazor :) Unfortunately I won't get to looking at this for several days.

Done. Not sure how to make it show up here. I am more of a lurker...

Great, Thanks. I have converted a lurker. Mission accomplished for me today. One of my goals is to get more contributors involved with MatBlazor and my repo BlazorBoilerplate!

To make it show up you just need to put the # sign and the issue number in your PR and github automagically references it. So just edit your commit comment with the #259.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kristof12345 picture kristof12345  路  5Comments

Kylar182 picture Kylar182  路  4Comments

PeteJobi picture PeteJobi  路  4Comments

TheAnachronism picture TheAnachronism  路  6Comments

lkmcelik picture lkmcelik  路  4Comments