我正在使用 PrimeNg 表來顯示我的專案。
<p-table *ngIf="certificates | async as certificates" [value]="certificates">
<ng-template pTemplate="header">
<tr>
<th style="max-width: 40%">Name</th>
<th style="max-width: 10%">Valid</th>
<th style="max-width: 10%">Active</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-certificate>
<p-skeleton *ngIf="loading"></p-skeleton>
<tr *ngIf="!loading">
<th>{{ certificate.name }}</th>
<td>{{ certificate.pac }}</td>
<td><i ></i></td>
<td>
<input
(click)="getActiveStatus(certificate)"
[checked]="certificate.active"
type="radio"
/>
</td>
</tr>
</ng-template>
</p-table>
我希望能夠只選擇一個單選按鈕。現在我可以單擊并選擇我所有的單選按鈕,但我不希望出現這種情況。有誰知道一次只能選擇一個單選按鈕?
uj5u.com熱心網友回復:
嘗試將具有相同值的“名稱”屬性附加到所有單選按鈕:
<input
(click)="getActiveStatus(certificate)"
[checked]="certificate.active"
type="radio"
name="group1"
/>
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/452430.html
上一篇:Condition
