javascript - Open mat-expansion-panel ONLY when button is clicked - Stack Overflow

Is there a way in which I can make my mat-expansion-panel open ONLY WHEN I click a certain button?I am

Is there a way in which I can make my mat-expansion-panel open ONLY WHEN I click a certain button?

I am thinking of having a list of info that I can click an edit icon on, which would cause the expansion to happen revealing the edit options...

Of course, I do not want the panel to expand when clicking randomly on the row, but only on the edit icon...

Is there a way in which I can make my mat-expansion-panel open ONLY WHEN I click a certain button?

I am thinking of having a list of info that I can click an edit icon on, which would cause the expansion to happen revealing the edit options...

Of course, I do not want the panel to expand when clicking randomly on the row, but only on the edit icon...

Share Improve this question asked Dec 4, 2018 at 8:51 physicsboyphysicsboy 6,35822 gold badges77 silver badges139 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 9

you need to add to your styles.css file the following code:

span.mat-expansion-indicator
{
   pointer-events: visiblefill !important; 
}

mat-expansion-panel-header 
{
   pointer-events: none;
}

#HTML CODE:

<mat-expansion-panel [expanded]="panelOpenState">

<mat-expansion-panel-header>
    <mat-panel-title>
        Edit
    </mat-panel-title>
</mat-expansion-panel-header>
<p>Edit Body</p>
</mat-expansion-panel>

<button (click)="togglePanel()">Edit</button>

#TS CODE:

panelOpenState: boolean = false;

togglePanel() {
this.panelOpenState = !this.panelOpenState
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742380983a4433110.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信