【发布时间】:2021-03-21 19:29:11
【问题描述】:
所以我有这些单选按钮:
<form [formGroup]="myForm" class="location_filter">
<label style="font-weight: 500; color: #C0C0C0">Select a button: </label>
<mat-radio-group>
<div class="p-field-radiobutton">
<mat-radio-button name="locationType" (click)="clickeEvent()" value="theFirst"
[disabled]="isDisabled" inputId="theFirst" formControlName="locationType" id="myRadioButton" >
</mat-radio-button>
<label for="theFirst" id="1Radio">Radio 1</label>
</div>
<div class="p-field-radiobutton">
<mat-radio-button name="locationType" (click)="clickeEvent()" value="theSecond"
[disabled]="isDisabled" inputId="theSecond" formControlName="locationType" >
</mat-radio-button>
<label for="theSecond" style="color: #C0C0C0">Radio 2</label>
</div>
</mat-radio-group>
</form>
我有 3 个问题:
- 如何在页面加载时默认使用第一个收音机?
- 在选择特定的单选按钮时,如何更改文本颜色?
- 我根据条件禁用了按钮,如何同时禁用附加到它的点击事件?
我有点弱角形式,所以非常感谢任何帮助或建议。 谢谢
【问题讨论】:
标签: javascript html angular typescript forms