Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
I want to control my mat-expansion-panel solely with the panel's [expanded] input property. I am using NGRX as state management.
Therefore, I don't want the panel to open when clicked. Instead, I have my own click listener that will dispatch the right action that will lead to the panel to open.
How can I prevent it from opening when clicked? I tried (click)="$event.stopImmediatePropagation(); but it does not do the trick.
@crisbeto That would change the appearance, make it unusable with keyboard and propagate wrong information to screen readers. It should just not open automatically
Ideally there would be a boolean input to disable automatic opening and an event so the developer doesn't need to write the listener itself.
Btw this may be useful for other components too. e.g. Tabs, Tree etc.
@crisbeto The event handler will dispatch an action and as result of the action processing and state change the panel will open.
In the easiest case the action will just open the panel. But it's also possible to open the panel only after you have successfully loaded data from external sources, or display an error if that fails.
The possibilities of what is done before opening the panel are almost unlimited.