<h1 mat-dialog-title>Select students</h1>
<div mat-dialog-content>
  <mat-selection-list #selection>
    <mat-list-option *ngFor="let student of possibleStudents" [value]="student.id">
      {{student.firstname}} {{student.lastname}}
    </mat-list-option>
  </mat-selection-list>
  <span *ngIf="possibleStudents?.length === 0">You cannot add more students</span>
</div>
<div mat-dialog-actions>
  <button mat-button (click)="onNoClick()">Cancel</button>
  <button *ngIf="possibleStudents !== undefined && possibleStudents.length > 0" mat-button [mat-dialog-close]="selection.selectedOptions.selected">Add
  </button>
</div>