How to toggle Angular material expansion panel programmatically

前端 未结 6 1105
半阙折子戏
半阙折子戏 2021-02-12 16:20

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

6条回答
  •  时光说笑
    2021-02-12 17:25

    Simple implementation for array of panels

    
        ...
        
        ...
    
    

    And in code

    indexExpanded: number = -1;
    
    togglePanels(index: number) {
        this.indexExpanded = index == this.indexExpanded ? -1 : index;
    }
    

提交回复
热议问题