I built an md-menu
with an md-tab-group
inside, using Angular Material 2. On each md-tab
I display a different list. The behavior I'm expecting to see is that the user to be able to switch between tabs and the md-menu
to stay opened.
The thing is that the md-menu
closing on every click on one of the tabs.
<img src="/assets/images/ic-notifications.png" [mdMenuTriggerFor]="appMenu"/>
<md-menu #appMenu="mdMenu" [overlapTrigger]="false" yPosition="below" xPosition="before" class="notifications-dropdown">
<md-tab-group >
<md-tab label="My profile" id="personal">
<div class="row notification-row" *ngFor = "let notification of profile_notifications">
...
</div>
</md-tab>
<md-tab label="Favorites " id="favorite-tab" >
...
</md-tab>
</md-tab-group>
</md-menu>
How can I prevent the md-menu
from closing?
You need to stop the mouse click propagation. You can do it like this:
and in your component.ts file:
Link to Plunker Demo.