I am using Angular 6 and angular material data-table with checkbox I want to select one checkbox at one time.
Mat checkbox I am using as a checkbox.
the only one can show selected checked and previous one unchecked.
<span *ngIf="key.data == 'check'">
<td mat-cell *matCellDef="let row ; let i = index;">
<mat-checkbox (click)="checkBoxSelected(row, i)"></mat-checkbox>
</td>
</span>
How to i hendle in typescipt so
If I selected Both it allows me to do
*but i want to select only one at a time so if you have an idea or you want to idea what check here like *
For selecting only one checkbox at one time, you can make changes in your code like this:
<tr *ngFor="let item of managerList;let i = index">
<td scope="row">
<div class="media align-items-center">
<mat-checkbox [disabled]="isDisabled" [checked]="selected === i" (change)="selected
=i" id="{{item.id}}" #checkbox="matCheckbox" (click)="getrecord(checkbox,element)"> {{item.fullName}} </mat-checkbox>
</div>
</td>
</tr>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.