2

I use this code in my Angular5 application:

<mat-selection-list>
        <mat-list-option *ngFor="let activityType of activityTypes" [selected]="isActivityTypeSelected(activityType)" (click)="addSelectedActivityType(activityType)">{{activityType | translate}}</mat-list-option>
 </mat-selection-list>

and in some cases I will disable the mat-list-option. Therefore I tried it like this ([disabled]="closedCalendarEvent"):

<mat-list-option *ngFor="let activityType of activityTypes" [selected]="isActivityTypeSelected(activityType)" (click)="addSelectedActivityType(activityType)" [disabled]="closedCalendarEvent">{{activityType | translate}}</mat-list-option>

but it does not work, thd checkboxes are still clickable. Does anyone know what I can do in order to disable the checkboxes of mat-list-option?

quma
  • 5,233
  • 26
  • 80
  • 146
  • Please post your code for`closedCalendarEvent` - there is no obvious reason why it shouldn't work. As a test, try `[disabled]="true"`. – G. Tranter May 14 '18 at 20:55
  • 1
    The problem was that I also listened to (click) events and that worked fine although [disabled] was true. – quma May 22 '18 at 07:25
  • @quma, did you ever figure out how to get it working? I am having similar problem. – Daniel Oct 18 '22 at 01:43

0 Answers0