根据所选内容,某些字段需要禁用。如果选择了 isTest 和 isFunctional,则应禁用 isTimed 和反向。如果选择 isTimed,则应禁用 isTest 和 isFunctional。检查代码:
<div class="checkbox">
<label for="waiting"> waiting </label>
<input class="input-control checkbox-box" [attr.disabled]="vajica" (change)="checkboxChanged($event)" formControlName="isTest" name="waiting" id="waiting"
type="checkbox">
</div>
<div class="checkbox">
<label for="functional"> functional </label>
<input class="input-control checkbox-box" [attr.disabled]="vajica" (change)="checkboxChanged($event)" formControlName="isFunctional" name="functional" id="functional"
type="checkbox">
</div>
<div class="checkbox">
<label for="test"> test </label>
<input class="input-control checkbox-box" [attr.disabled]="testica" (change)="checkboxChanged($event)" formControlName="isTimed" name="test" id="test" type="checkbox">
</div>
vajica: boolean = false;
testica: boolean = false;
checkboxChanged(e){
console.log(e.target);
console.log(this.exerciseAddForm);
if(this.exerciseAddForm.value.isTimed){
alert('true')
this.vajica = true;
}
if(this.exerciseAddForm.value.isTest ||this.exerciseAddForm.value.isFunctional) {
this.testica = true;
}
}
慕森王
UYOU
慕的地6264312
相关分类