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
bug(cdkMenu): menu template context is not updated when cdkMenuTriggerData is changed #26256
Comments
I'm also experiencing this issue. I think its because of this check: components/src/cdk/menu/menu-trigger-base.ts Line 107 in 5d41978
If i'm reading it correctly if the templateref hasnt changed the data is not updated. |
I believe the way you are using the |
In your example you don't use template context at all. You use counter value from component class, not from template context. So, why the issue was closed if the bug is still here? |
Oh whoops, that's my bad |
Also stumbled upon this issue while trying to reorder a list with some I've modified the initial StackBlitz to re-render on increment, and it seems to work just fine. Thought this workaround might help someone while we get a proper way of handling this issue. |
We just encountered this behavior:
The solution @heunetik is offering does work, but feels hacky considering it should correctly detect that a re-render of the menu Is Angular team planning to consider a fix for this or lead contributors to a desired fix? Or shall we avoid this patterns? (that worked this way with MatMenu) |
Is this a regression?
The previous version in which this bug was not present was
No response
Description
When cdkMenuTriggerData is used to pass additional context to a menu template the template context is not update when the data is changed.
Reproduction
GitHub
StackBlitz
Steps to reproduce:
Expected Behavior
Counter value in the context menu should be in sync with the value on the "Click Me!" button.
Actual Behavior
Counter value in the context menu keep initial value and is not updated when context changes.
Environment
The text was updated successfully, but these errors were encountered: