Reputation: 3140
<mat-selection-list [(ngModel)]="selectedContactTypes" [ngModelOptions]="{standalone: true}">
<mat-list-option *ngFor="let ct of contacttypes" [checkboxPosition]="before" [value]="ct.id+'_'+ct.description">
<mat-icon matListIcon>perm_contact_calendar</mat-icon>
{{ct.description}}
</mat-list-option>
</mat-selection-list>
Upvotes: 2
Views: 6509
Reputation: 347
In this case, wrapping them on a div
will do the job:
<mat-selection-list [(ngModel)]="selectedContactTypes" [ngModelOptions]="{standalone: true}">
<mat-list-option *ngFor="let ct of contacttypes" [checkboxPosition]="before" [value]="ct.id+'_'+ct.description">
<div>
<mat-icon matListIcon>perm_contact_calendar</mat-icon>
{{ct.description}}
</div>
</mat-list-option>
</mat-selection-list>
Update
And, if you wanna center them vertically, apply display: flex
and align-items: center
to the div
<mat-selection-list [(ngModel)]="selectedContactTypes" [ngModelOptions]="{standalone: true}">
<mat-list-option *ngFor="let ct of contacttypes" [checkboxPosition]="before" [value]="ct.id+'_'+ct.description">
<div class="center-vertically">
<mat-icon matListIcon>perm_contact_calendar</mat-icon>
{{ct.description}}
</div>
</mat-list-option>
</mat-selection-list>
CSS:
.center-vertically{
display:flex;
align-items: center;
}
Upvotes: 4