Closed pkdigital closed 9 months ago
When binding an array of a data to the p-dropdown control and that data value field is a typescript type the control is unable to display the corresponding name member.
Primeng 16.7.2 Angular 16.2.0
https://stackblitz.com/edit/bpr5uy-vq3hq7?file=src%2Fapp%2Fdemo%2Fdropdown-basic-demo.html
16.2.0
16.7.2
Angular CLI App
TypeScript
18
Any
Control markup
<p-dropdown [options]="cities" [(ngModel)]="selectedCityCode" optionLabel="name" optionValue="code" showClear="true" placeholder="Select a City" ></p-dropdown>
Type definition
type CityCode = 'NY' | 'LDN' | 'RM' | 'IST' | 'PRS';
Bound values
cities: { name: string; code: CityCode }[] = [ { name: 'New York', code: 'NY' }, { name: 'Rome', code: 'RM' }, { name: 'London', code: 'LDN' }, { name: 'Istanbul', code: 'IST' }, { name: 'Paris', code: 'PRS' } ];
Output:
No response
Sorry, just realised this is a dupe of #14054
Describe the bug
When binding an array of a data to the p-dropdown control and that data value field is a typescript type the control is unable to display the corresponding name member.
Environment
Primeng 16.7.2 Angular 16.2.0
Reproducer
https://stackblitz.com/edit/bpr5uy-vq3hq7?file=src%2Fapp%2Fdemo%2Fdropdown-basic-demo.html
Angular version
16.2.0
PrimeNG version
16.7.2
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18
Browser(s)
Any
Steps to reproduce the behavior
Control markup
Type definition
type CityCode = 'NY' | 'LDN' | 'RM' | 'IST' | 'PRS';
Bound values
Output:
Expected behavior
No response