question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nzMatchRouterExact in nz-menu-item not works

See original GitHub issue

Steps to reproduce

I set different fragments in both nz-submenu and nz-menu-item, furthermore I set [nzMatchRouterExact]=“true” in nz-menu-item. I expected only nz-submenu is active, but not nz-menu-items. However, all of the nz-menu-item are active.

HTML codes: 
      <li nz-submenu nzTitle="联系我们"  [routerLink]="['/contact-us',0]" [fragment]="['i0']">
        <ul>
          <li nz-menu-item [nzMatchRouter]="true" [nzMatchRouterExact]="true">
            <a [routerLink]="['/contact-us',1]" [fragment]="['i1']">公司地址</a>
          </li>
          <li nz-menu-item [nzMatchRouter]="true" [nzMatchRouterExact]="true">
<!--              [class.ant-menu-item-selected]="(activeFragment | async) === 'i2'">-->
            <a [routerLink]="['/contact-us',2]" [fragment]="['i2']">客户建议</a>
          </li>
        </ul>
      </li>


Reproduce

https://stackblitz.com/edit/ng-zorro-antd-start-s3g69x?file=src/app/app.component.html

What is expected?

only nz-submenu is active, but not nz-menu-items.

What is actually happening?

all of the nz-menu-item are active.

Environment Info
ng-zorro-antd 10.0.2
Browser chrome85.0.4183 and Safari

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
alex644715commented, Apr 9, 2021

Is there any news?

0reactions
aurelijuslemcommented, Aug 31, 2022

Any updates?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Menu | NG-ZORRO - Ant Design
Automatically activate menu items based on routing, should work with routerLink. ... [nzDisabled], whether menu item is disabled or not, boolean, false.
Read more >
Highlight current route item without clicking it - Stack Overflow
I have menu items that can be clicked and takes to different routes. When route is changed by clicking on item, it stays...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found