I have primeng dropdown p-drowdown
and fetching options value from database. But the problem is
dropdown value formControlName="fromWarehouseId"
is assigned before [options]="fromWarehouseList"
is assigned. For example ;
<p-dropdown
#fromWareHouse
[options]="fromWarehouseList"
class="w-100"
formControlName="fromWarehouseId"
placeholder="{{ 'form.btn.select' | translate }}"
>
</p-dropdown>
I have this dropdown in my component template. When the page is loaded fromWarehouseList
is being assigned asynchronously but the formControlName fromWarehouseId
is being assigned
immediately and as a result user can't see dropdown value correctly. What I have tried so far ;
Tried to use observable to notify parent component when
p-dropdown
is rendered. But couldn't manageTried to use
ngAfterViewInit
in parent component but didn't change anything.Tried to use
settimeOut
but ı don't think it's right thing to do.