IT
Angular Ionic ion radio checked 예시 / *ngFor checked radio
agnusdei1207
2023. 4. 20. 12:40
반응형
SMALL
<div *ngFor="let item of auth" class="flex">
<label>{{item}}</label>
<input
formControlName="auth"
class="accent-primary w-12 y-12 cursor-pointer"
type="radio"
[value]="item"
[checked]="item === admin.auth"
/>
</div>
1. 첫 번째 방법
<div *ngFor="let role of roles" class="flex">
<label>{{role}}</label>
<input
(click)="handleRole(role)"
class="accent-primary w-12 y-12 cursor-pointer"
type="radio"
[checked]="role === adminForm.controls['role'].value"
/>
</div>
handleRole(role: string) {
this.adminForm.controls['role'].setValue(role);
}
2. 두 번째 방법
반응형
LIST