【发布时间】:2017-06-23 14:41:24
【问题描述】:
我想更改 json 中的名称以在页面中显示(离子选择)
mycodehtml
ion-select [(ngModel)]="refine" (ionChange)="optionsFn(item, i);" >
<ion-option [value]="item" *ngFor="let item of totalfilter;let i = index" >{{item["@NAME"]}}</ion-option>
</ion-select>
我的json
"FACETLIST":{
"FACET":[
{
"@NAME":"creator",
"@COUNT":"2"
},
{
"@NAME":"lang",
"@COUNT":"1"
},
{
"@NAME":"rtype",
"@COUNT":"1"
}
],
"FACET":[
{
"@NAME":"lang",
"@COUNT":"4"
},
{
"@NAME":"rtype",
"@COUNT":"2"
}
]
}
上面的这个 ionic select show creator lang 和 rtype 但我想更改 @NAME 以在页面中显示
示例创建者->创建者,语言->语言
但我不想更改 json 中的值(我想更改以在页面中显示)
【问题讨论】:
-
您为什么不使用所需的值复制此 JSON 并在视图中使用它。或者如果检查循环并将这两个转换为所需的,则可能是脏的解决方案。
标签: javascript html json typescript ionic2