问题描述
我将JSON结果放入选择下拉菜单的选项列表中
[
{
"id": "1596700684533_","name": "Usman Abbas Ghulam Abbas","fcm": "344"
},{
"id": "1596700972722_","name": "Muhammad Ali","fcm": "0"
},{
"id": "1596702420255_","name": "Abdul Hannan Abdul Mannan","fcm": "234"
}
]
- 单击按钮时如何选择完整的对象和id和fcm之类的对象值
我的component.htlm代码是
<select (change)="Selected($event)">
<option *ngFor="let group of groups" [value]="group.fcm">
{{group.name}}
</option>
</select>
当前在单击按钮时,我可以获取一个值id或fcm
Selected(event: any){
//update the ui
this.selectedName = event.target.value;
//this.selectedId = event.targent.value.id
this.hide=false;
}
getVal(){
this.button=this.selectedName;
console.log("hre is selected values for option " + this.selectedName);
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)