I have the massive of employees positions:
positions = [
{
id: '0',
title: 'position0',
},
{
id: '1',
title: 'position1',
},
{
id: '2',
title: 'position2',
},
{
id: '3',
title: 'position3',
},
];
I create reactive form. As you see, single field of this form is not initialized:
form: FormGroup = new FormGroup({
position: new FormControl(),
});
Then i try to display this form using select box:
<div [formGroup]="form">
<p-dropdown
[options]="positions"
formControlName="position"
optionValue="id"
optionLabel="title"
>
</p-dropdown>
</div>
I expect that this select box will be empty at the first load. However there is selected 'position0' value. It is a problem.
I need the displaying label like 'Please choose position'.
Here is the live example