I just started working on an Angular 4 project with material design.
I am currently working with the expansion component, the API states that a disabled expansion pa
Suppose you are looking for the way to trigger open() method from the component on button click, this is what I've been able to get from the material API documentation.
import { MatAccordion, MatExpansionPanel } from '@angular/material/expansion';
export class MyComponent implements OnInit {
@ViewChild(MatExpansionPanel) pannel?: MatExpansionPanel;
@ViewChild(MatAccordion) accordion?: MatAccordion;
constructor(){}
closePannel() { // for expansion panel only
if(!this.pannel) { return }
this.pannel.close();
}
closeAll() { // for all panels in accordion
if(!this.accordion) { return }
this.accordion.closeAll();
}
}