【发布时间】:2016-09-30 05:51:24
【问题描述】:
请帮助我了解如何在primeng SelectItem[] 数组中找到特定值。
我有如下 selectItem 数组。
this.cities = [];
this.cities.push({label:'Select ', value:null});
this.cities.push({label:'New York', value:{id:1, name: 'New York', code: 'NY'}});
this.cities.push({label:'Rome', value:{id:2, name: 'Rome', code: 'RM'}});
this.cities.push({label:'London', value:{id:3, name: 'London', code: 'LDN'}});
this.cities.push({label:'Istanbul', value:{id:4, name: 'Istanbul', code: 'IST'}});
this.cities.push({label:'Paris', value:{id:5, name: 'Paris', code: 'PRS'}});
我想从上面的列表中找到特定的项目({id:5,name:'Paris',code:'PRS'})。或者我只想找到代码为“PRS”的商品。
【问题讨论】:
标签: primeng