suppose i have a employee information screen with city as a dropdown, i select a city (say NY) and store in the DB. when i pull this record later on for editing , the city dropdown should display NY.
how do i achieve this?
<p-dropdown [options]="arrCityDropDown" [(ngModel)]="selectedCity" filter="true"
(onChange)="onChange_City($event)" [style]="{'width':'100%'}"></p-dropdown>
am i missing something?
thanks in advance.
Display dropdown with an existing value.
Hi,
In your ts file selectedCity should point to your preselected value.
For example;
selectedCity: string = 'New York';
Dropdown will show default value selected at the beginning.
In your ts file selectedCity should point to your preselected value.
For example;
selectedCity: string = 'New York';
Dropdown will show default value selected at the beginning.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 23 guests