Yoedusvany Hdez
Yoedusvany Hdez

Reputation: 445

How to set an angular mat panel expandable always expanded

is there any way to set an angular mat panel expandable always expanded?. I don't want to close it when user clic on the panel header

Thanks...

Upvotes: 6

Views: 15172

Answers (4)

Mahmoud Kassem
Mahmoud Kassem

Reputation: 429

A better solution: .mat-expansion-panel-header { pointer-events: none; }

You will need to disable view encapsulation: encapsulation: ViewEncapsulation.None

Upvotes: 0

tanasi
tanasi

Reputation: 1804

*ngIf helped me in my case where I needed to check for variable from service and if it is set to true then I will expand the panel:

<mat-expansion-panel *ngIf="navigationService.varIsTrue || true"
                     [expanded]="navigationService.varIsTrue" 
</mat-expansion-panel>

Upvotes: 0

Purushottam Sadh
Purushottam Sadh

Reputation: 1127

Below code works for all scnerio, please check.

<mat-expansion-panel *ngIf="currentCommittee" [expanded]="true"> 

Upvotes: 3

Gwen
Gwen

Reputation: 474

<mat-expansion-panel [disabled]="true" [expanded]="true">

see https://material.angular.io/components/expansion/api

Upvotes: 14

Related Questions