angular - formControlName 显示 [object,object]
问题描述
我的 FormControl 有一个 JSON 对象,我将它绑定到相应的字段并[object,object]
在视图中查看结果。
let fSource = {
name: 'India',
code: 'IN'
};
this.myForm.get('defaultLocation').setValue(fSource);
但我只需要在输入字段中显示名称(印度)。我该如何绑定它?
解决方案
你的意思是?
this.myForm.get('defaultLocation').setValue(fSource.name);
推荐阅读
- swift - 在swift 5中创建一个mysql连接函数
- javascript - JavaScript。将生成的单选按钮从写入到 HTML 从循环更改为不同类型的输入
- jquery - 外部文件中的 jQuery 似乎不起作用
- ios - 如何在地图上显示多个注释?
- vim - 如何更改 python vim 模块中行号的内容?
- spring-boot - Spring Boot 容器在另一个容器中找不到 kafka 代理
- python - Python,使用简单循环获取数组的最大值
- html - 如何将下拉 div 的宽度设置为与其按钮相同
- android - BottomNavigationView 的标题颜色为渐变
- excel - 具有动态行的 Countif 函数