Skip to content
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 doesn't work with CanDeactivate and current route #4407

Closed
nitrexx opened this issue Nov 8, 2019 · 3 comments
Closed

nz-menu-item doesn't work with CanDeactivate and current route #4407

nitrexx opened this issue Nov 8, 2019 · 3 comments

Comments

@nitrexx
Copy link

nitrexx commented Nov 8, 2019

Reproduction link

https://stackblitz.com/github/nitrexx/ng-zorro-menu-bug

Steps to reproduce

  1. Create 2 components with router
  2. Create component with nz-menu with nzMatchRouter
  3. Create Interface wiht CanDeactivate method
  4. Implements Interface with CanDeactivateMethod in components and return false
  5. Create guard for canDeactivate router paramater
  6. Click on first item in menu, it will change a route to the component
  7. Click on second item (canDeactivate returns false and route is same like in previous step), ng-menu-item change active item to the second item

What is expected?

It shouldn't change selected item in menu on click but on the route if I use nzMatchRouter

What is actually happening?

It changes selected menu item on click event and not depends on route

Environment Info
ng-zorro-antd 8.4.1
Browser google chrome Version 77.0.3865.120 (Official Build) (64-bit)
@yanqzsu
Copy link
Contributor

yanqzsu commented Jan 3, 2020

I have the same problem.
Is there any thing can help me on this issue?

@wenqi73
Copy link
Member

wenqi73 commented Jan 6, 2020

Maybe we should also listen NavigationCancel router event.

@vthinkxie
Copy link
Member

vthinkxie commented Jan 28, 2020

Hi @keyman169
you can add nzSelectable="false" in the current design, https://stackblitz.com/edit/github-5lxjne?file=src/app/common/pending-changes-guard.ts
we will make it default with nzMatchRouter in next version

@vthinkxie vthinkxie added this to the 9.0.0 milestone Jan 28, 2020
Ricbet pushed a commit to Ricbet/ng-zorro-antd that referenced this issue Apr 9, 2020
@hsuanxyz hsuanxyz mentioned this issue Apr 15, 2020
hsuanxyz pushed a commit to hsuanxyz/ng-zorro-antd that referenced this issue Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants