Angular 如果存在验证,如何阻止单选按钮被检查

Angular 如果存在验证,如何阻止单选按钮被检查,angular,Angular,我的布局有三个单选按钮,如下所示: <div class="radio"> <label> <input type="radio" name="optradio" value="ABC" (change)= "showSection($event, 'abc')" checked>&nbsp; <span> ABC </span> </label>

我的布局有三个单选按钮,如下所示:

<div class="radio">
        <label>
          <input type="radio" name="optradio" value="ABC" (change)= "showSection($event, 'abc')" checked>&nbsp; <span> ABC </span>
        </label>
        </div>
        <div class="radio">
          <label>
            <input type="radio"  name="optradio"  value = "EFG" (change) = "showSection($event, 'EFG')">&nbsp;<span> EFG </span> 
          </label>
        </div>
        <div class="radio ">
          <label>
            <input type="radio"   name="optradio" value = "HIJ"  (change) = "showSection($event, 'HIJ')">&nbsp;<span> HIJ </span> 
          </label>
        </div>

我有一个验证,如果
array\u two.length我不确定这是您想要的:

我创建了一个formgroup来检查他的孩子的价值:

this.form = new FormGroup({
  gender: new FormControl(),
  age: new FormControl(),
  city: new FormControl()
});
当你点击一个单选按钮时,他的值会被推送到数组和条件中


array_two.length我不确定这是您想要的:

我创建了一个formgroup来检查他的孩子的价值:

this.form = new FormGroup({
  gender: new FormControl(),
  age: new FormControl(),
  city: new FormControl()
});
当你点击一个单选按钮时,他的值会被推送到数组和条件中


array_two.length如果我理解正确,您需要根据条件禁用所有单选按钮。为此,您需要将
禁用的
属性绑定与单选按钮一起使用,如下所示:

[disabled]="array_two.length <=1"

[disabled]=“array\u two.length如果我理解正确,您需要根据条件禁用所有单选按钮。为此,您需要使用
disabled
属性绑定单选按钮,如下所示:

[disabled]="array_two.length <=1"

[disabled]=“array\u two.length请发布一个stackblitz示例,我不完全理解你的问题。@Robert:如果条件/验证得到满足,我必须停止我的单选按钮才能被选中。你是否试图将radiobutton的disable property绑定到一个检查条件语句的布尔变量?@Robert:我无法使其禁用这三个按钮只需处于启用模式。请发布一个stackblitz示例,我不完全理解你的问题。@Robert:如果条件/验证得到满足,我必须停止我的单选按钮以被选中。你是否尝试将radiobutton的disable property绑定到检查条件语句的布尔变量?@Robert:我无法使它禁用这三个按钮,它们只需要处于启用模式。我不知道需要这样一个好例子robert如果我的阵列长度超过1,我只需要一种方法将我的收音机停止到新的选定状态如果我的阵列长度超过1,我不需要这样一个好例子robert我只需要一种方法将我的收音机停止到新的选定状态如果我的阵列长度超过1
[disabled]="array_two.length <=1"