[英]angular chekcbox is checked change other input value
我想找到一个解决方案,如果我选中一个复选框,那么另一个 div 中输入字段的值将更改为禁用。
``
<div class="24hr-example">
<input placeholder="24hr format" aria-label="24hr format" [ngxTimepicker]="fullTime" [format]="24" readonly>
<ngx-material-timepicker #fullTime></ngx-material-timepicker>
</div>
``
<app-checkbox [checked]="openingHours.is_closed_all_day" (change)="openingHours.is_closed_all_day = !openingHours.is_closed_all_day"></app-checkbox>
因此,如果我单击复选框,则给定的输入字段的值将被视为禁用。 我试图用一个函数来解决它,但它不起作用。 什么解决方案可以解决这个问题?
<input type="checkbox" [(ngModel)]="isChecked" (change)="checkValue(isChecked)" />
在你的班级里:
checkValue(event: any){
console.log(event);
if(any){
// disable value
}else{
//enable value
}
}
希望你明白逻辑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.