-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nz-menu-item支持根据路由自动高亮 #52
Comments
大兄弟, |
@shaodahong |
a标签的写法有问题,换个写法试试 |
@shaodahong |
@wanghaolu please check your code and https://angular.cn/guide/router for more detail. The method that @shaodahong provided is right. |
@shaodahong @vthinkxie |
@wanghaolu please check the doc site's(https://ng.ant.design) source code: The doc site also uses lazy load mode, and |
@vthinkxie |
@vthinkxie 我已经新建了一个项目并复现了该问题,确认了在通过lazy load加载的模块中的menu上使用routerLinkActive="ant-menu-item-selected"无效。 |
@wanghaolu bug confirm, thanks |
another way to bind nzSelected or nzOpen is use the readonly prop isActive angular doc below
and you can do like below (which could make menu parent auto selected)
|
ant-menu-item-selected |
I'm going with @zhhb approach since it's more solid than relying on a class name |
@zhhb great solution, works with forloop also thanks |
I'm submitting a...
Current behavior
在zn-menu-item中添加了路由后没法根据当前的默认路径自动高亮
Expected behavior
在默认跳转到指定路径时routerLinkActive匹配的路由能够自动高亮
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment
The text was updated successfully, but these errors were encountered: