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

matMenuTriggerData not working with nested menu #12467

Closed
anisabboud opened this issue Aug 1, 2018 · 2 comments · Fixed by #12476
Closed

matMenuTriggerData not working with nested menu #12467

anisabboud opened this issue Aug 1, 2018 · 2 comments · Fixed by #12476
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@anisabboud
Copy link

Bug

Switching between submenus doesn't pass the [matMenuTriggerData] properly.
It passes only to the first selected submenu, but the data is empty when selecting other submenus after the first.
nestedmenu

What are the steps to reproduce?

Sample code: https://stackblitz.com/edit/angular-nevxe3?file=app%2Fnested-menu-example.html

<button mat-button [matMenuTriggerFor]="animals">Animal index</button>

<mat-menu #animals="matMenu">
  <button mat-menu-item [matMenuTriggerFor]="submenu" [matMenuTriggerData]="{category: 'vertebrates'}">Vertebrates</button>
  <button mat-menu-item [matMenuTriggerFor]="submenu" [matMenuTriggerData]="{category: 'invertebrates'}">Invertebrates</button>
</mat-menu>

<mat-menu #submenu="matMenu">
  <ng-template matMenuContent let-category="category">
    <button mat-menu-item>You selected: {{category}}</button>
  </ng-template>
</mat-menu>

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 6.1.0
Material 6.4.2

@crisbeto crisbeto self-assigned this Aug 1, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 1, 2018
…s reused between nested triggers

Fixes an issue where a nested menu with lazy-loaded that is reused between multiple triggers will clear its content once an alternate trigger is hovered. The issue comes from the fact that we wait for the exit animation to finish before we detach the content, which ends up detaching the content of the new trigger as well.

Fixes angular#12467.
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent has pr labels Aug 1, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 1, 2018
…s reused between nested triggers

Fixes an issue where a nested menu with lazy-loaded that is reused between multiple triggers will clear its content once an alternate trigger is hovered. The issue comes from the fact that we wait for the exit animation to finish before we detach the content, which ends up detaching the content of the new trigger as well.

Fixes angular#12467.
jelbourn pushed a commit that referenced this issue Aug 7, 2018
…s reused between nested triggers (#12476)

Fixes an issue where a nested menu with lazy-loaded that is reused between multiple triggers will clear its content once an alternate trigger is hovered. The issue comes from the fact that we wait for the exit animation to finish before we detach the content, which ends up detaching the content of the new trigger as well.

Fixes #12467.
jelbourn pushed a commit that referenced this issue Aug 7, 2018
…s reused between nested triggers (#12476)

Fixes an issue where a nested menu with lazy-loaded that is reused between multiple triggers will clear its content once an alternate trigger is hovered. The issue comes from the fact that we wait for the exit animation to finish before we detach the content, which ends up detaching the content of the new trigger as well.

Fixes #12467.
@anisabboud
Copy link
Author

Thank you for the quick fix!

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
2 participants