gpt4 book ai didi

javascript - 如何通过 Angular 单选按钮启用或禁用提交按钮

转载 作者:行者123 更新时间:2023-11-28 11:43:31 28 4
gpt4 key购买 nike

代码如下:

list.component.html

<nz-radio-group formControlName="radiostatus" [(ngModel)]="radioValue" (ngModelChange)="onChangeStatus($event)">
<label nz-radio nzValue="passed">Passed</label>
<label nz-radio nzValue="failed">Failed</label>
</nz-radio-group>
<button class="mr-1" nz-button nzType="primary" type="button" [disabled]="disableSubmitBtn()">
<span translate>Submit</span>
</button>

当选择通过时,它应该启用提交按钮,如果选择失败,它应该禁用提交按钮

最佳答案

只需对代码进行一点小小的更改

<nz-radio-group formControlName="radiostatus" [(ngModel)]="radioValue" (ngModelChange)="onChangeStatus($event)">
<label nz-radio nzValue="passed">Passed</label>
<label nz-radio nzValue="failed">Failed</label>
</nz-radio-group>
<button class="mr-1" nz-button nzType="primary" type="button" [disabled]="radioValue == 'failed'">
<span translate>Submit</span>
</button>

关于javascript - 如何通过 Angular 单选按钮启用或禁用提交按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59298001/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com