I have primeng dropdown and two service calls, one making calls to get dropdown options and one to get model binding data. Once I saved the selected value and reload the page, occasionally selected value is not showing. I believe this because of the async nature of the service calls. I guess the model value service call is completed before loading all the dropdown options.
ngOnInit {
this.drpOption = this.ddOptionSrv.getDrpOption();
this.ddValueSrv.getDrpModelVal().subscribe(data => {
this.drValue = data
})
}
template code:
<p-dropdown [options]="drpOption | async" [(ngModel)]="drValue"></p-dropdown>
How do I make sure dropdown model value loads after dropdown options loads without moving the model service all inside the subscribed method of options call(maintaining the async nature)?