0
在selectItem數組中找到特定值請幫我瞭解如何在primeng SelectItem []數組中找到特定值。primeng:如何使用代碼
我有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'的物品。