Angular2在检查单选按钮时启用输入字段 [英] Angular2 enable an input field on check of radio button

查看:69
本文介绍了Angular2在检查单选按钮时启用输入字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遍历所有项目,如果选中某个单选按钮,我会撒谎显示一个输入框

Am iterating through items and i would lie to show an input box if a certain radio button is checked

这是表格

<ion-card *ngFor="let checklist of checklists;let i=index">

   <input type='radio' name="check{{checklist.id}}" value='yes_{{checklist.id}}'> Yes


   <input type='radio' name="check{{checklist.id}}" value='no_{{checklist.id}}'> Not passed


       <ion-item [hidden]="">//hide when Not passed radio is not checked
         <ion-label floating>Comment</ion-label>
         <ion-input type="text"></ion-input>
       </ion-item>

</ion-card>

如何在未选中否"的情况下隐藏评论区域,而仅在选中时显示?

How do i hide the comment area when no is not checked and show it only when checked

推荐答案

   <input #notPassed type='radio' name="check{{checklist.id}}" value='no_{{checklist.id}}'> Not passed


       <ion-item [hidden]="notPassed.value == '...'">//hide when Not passed radio is not checked

(我不知道您使用的是什么实际值,因此就是...)

(I don't know what actual values you are using, therefore just ...)

提示:还没有测试一下自己.

Hint: not tested myself yet.

这篇关于Angular2在检查单选按钮时启用输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆