Reputation: 176
I am following this https://www.primefaces.org/primeng/#/multiselect but docs have only information about to print value of a string. how can I display the object value. this.cities.push({label:'New York', value:{id:1, name: 'New York', cityCode: 'NY'}});
for instance i want to display code. I tried {{selectedCity.cityCode}} it is displaying [obj obj]
Upvotes: 0
Views: 2046
Reputation: 13307
Since selectedCity
is an array, you should use *ngFor
to loop through the items.
<div *ngFor="let city of selectedCities">
<p>{{city.id}}. {{city.cityCode}} - {{city.name}}</p>
</div>
Upvotes: 1