question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Md-expansion panel opened and close events not firing on prod build (beta.11)

See original GitHub issue

Bug, feature request, or proposal:

Looks like a bug.

What is the expected behavior?

Event handler is invoked when opened and closed events happen.

What is the current behavior?

Event handler is not invoked on opened and closed events.

What are the steps to reproduce?

Attach handlers for such events in the template and check if they are invoked after being built with angular cli’s ng build --prod.

What is the use-case or motivation for changing an existing behavior?

Has to be working in production build

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

Is there anything else we should know?

I’m attaching event handlers like this: <md-expansion-panel (closed)="onCollapse()" (opened)="onExpand()"> and process them in component. But these handlers are not invoked after prod build. It works OK when I do ng build --dev or ng serve.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:15
  • Comments:22 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
rfuhrercommented, Sep 27, 2017

Thanks @josephperrott .

If you’re like me and just upgraded your project and even ran the md -> mat upgrade so you really don’t want to rollback, you can get by with this horrible hack:

<mat-expansion-panel #expPanel>
  <mat-expansion-panel-header (click)="expPanel.expanded?onExpand():onCollapse()">

This won’t work if people use the keyboard to open and close a panel but it’ll get me by until the next version is out.

Edit: Just a heads up that I had some issues with my former workaround as it would sometimes fire the click event if you clicked something inside the expansion panel. Moving the click event handler down to the ‘mat-expansion-panel-header’ fixed the issue for me

5reactions
jmiccommented, Oct 14, 2017

@marxxxx no, the issue is reproducible in beta.12.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Material mat-expansion-panel opened event always ...
This is by design; the docs site specifies that the type of the opened event is void , so the event contains nothing....
Read more >
Expansion Panel | Angular Material
The <mat-expansion-panel-header> shows a summary of the panel content and acts as the control for expanding and collapsing. This header may optionally ...
Read more >
CHANGELOG_ARCHIVE.md - components - Fossies
autofill: avoid firing unnecessary event on initial render of input (#12116) ... with disabled autocomplete and no panel (#11881) (6b1a672), closes #11876 ...
Read more >
Visual Studio 2022 Preview Release Notes | Microsoft Learn
Get the latest pre-release features, bug fixes, and support for Visual Studio 2022 Preview. Download today.
Read more >
Angular 6 error show is not a known element - iTecNote
I am trying to use Angular Material in Angular 6 project but getting errors. 'mat-panel-title' is not a known element: 'mat-panel-description' is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found