gpt4 book ai didi

html - Angular 2 : how to clear the dropdown and textbox values while switching the radio buttons

转载 作者:太空狗 更新时间:2023-10-29 18:31:56 27 4
gpt4 key购买 nike

UI 显示两个单选按钮,一个是 YES,一个不是,文本框和下拉菜单在切换时都显示以前的值。请帮助我。

<div id="radio" class="row">Are you an existing client?</p>

<div class="form-check form-check-inline">
<label class="form-check-label">
<input type="radio" [(ngModel)]="radioValue" value="yes"/>yes
</label>
</div>

<div class="form-check form-check-inline">
<label class="form-check-label">
<input type="radio" [(ngModel)]="radioValue" value="no"/>no
</label>
</div>
</div>

<label *ngIf="radioValue == 'yes'">Select Client</label>
<select #select [(ngModel)]="cuurent" (change)=logDropdown(select.value) class="form-control input-group"
*ngIf="radioValue == 'yes'">
<option *ngFor="let item of list" [value]="item.id">{{item.name}}</option>
</select>

<div class="form-group">
<label *ngIf="radioValue == 'no'">Enter Client</label>
<input type="text" [(ngModel)]="inputsic" class="form-control input-group" *ngIf="radioValue == 'no'" />
</div>
</div>

最佳答案

<input type="radio" [(ngModel)]="radioValue" (ngModelChange)="reset()" value="yes"/>yes
<input type="radio" [(ngModel)]="radioValue" (ngModelChange)="reset()" value="no"/>no
reset() {
this.inputsic = '';
this.current = null;
}

关于html - Angular 2 : how to clear the dropdown and textbox values while switching the radio buttons,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42315828/

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