forum subscription

Wanna help programmers by answering latest Angular questions?

We will email you whenever a new question is posted in Angular section. Max 2 emails per week.

Primeng dynamic form dropdown (DynamicSelectModel) set data problem

Hi, Here I am using dynamic form.

dynamicSelectModelBirims: SelectModel[] = [];

export class SelectModel {
label: string;
value: any;
constructor(private formService: DynamicFormService, private helperService: HelperService,
private birimlerService: BirimlerService) {

setTimeout(() => {
this.formGroupValue = this.formService.createFormGroup(this.formModel);

}, 100);
// this.getBirims();
setTimeout(() => {

}, 1000);
FORM_MODEL.push(new DynamicSelectModel({
id: element.propertyName,
label: element.displayName,
placeholder: element.displayName,
options: this.dynamicSelectModelBirims, // or this.getBirims();

//value: "Aktif",
//disabled: false,


getBirims() {
(data: any) => {
if (data.statusCode == 200) {
this.birimler = data; => {
label: element.birimAdi,

The dynamic form in which I have provided code examples above must be loaded with dropdown data before loading html page. But because of the html page was previously installed, the page is loading with an empty dropdown before the service set datas to object. So the dropdown is empty. But when I print with console.log, the dynamicSelectModelBirims object has data. How can I solve this asynchronous problem ?

Mustafa Erdoğmuş 6 days ago
  • Whitelisted Links