angular - 选择选项角度2
问题描述
你好,与select选项相关的问题,这个人的属性是男M,在选择中必须有选择性别并用F改变它的可能性。属性是男entity.person.sex = 'M'
的,女的是entity.person.sex = 'F'
html
<span >
<span >
<span >Sesso</span>
<span ></span>
<select name='gender'>
<option [value]='' selected>{{entity.person.sex}}</option>
<option [ngValue]="">{{}}</option>
</select>
</span>
</span>
解决方案
您需要为更改事件调用一个函数:
<select name='gender' (change)="selectChangeHandler($event)">
<option ....
</select>
零件:
selectChangeHandler (event: any) {
//update the ui
this.entity.person.sex = event.target.value;
}
推荐阅读
- javascript - Firestore / Javascript:未捕获(承诺中)TypeError:无法在“节点”上执行“appendChild”:需要1个参数,但只有0个存在
- python - 有没有更聪明的方法来获取用切片对象切片的列表的索引?
- azure-aks - 带有虚拟节点和 Windows 操作系统的 Azure AK
- python - php hmac sha512签名在python中不起作用/不同
- c# - 加速 DataTable 迭代
- deep-linking - apple-app-site-association 文件不适用于最新更改
- php - php7 firebird驱动的Centos 7设置
- c# - 避免表中的重复
- swift - 如何在 UILabel Swift 中列出 Firebase 词典
- mysql - 当数据库中没有数据时,SQL 连接返回空记录