Binding Dropdown Options to Function

UI Components for Angular
Post Reply
magedassad
Posts: 2
Joined: 21 Jun 2019, 01:10

21 Jun 2019, 01:24

I have a form that creates fields dynamically. Some of the fields are dropdowns, I'm trying to bind the options to a method that gets the available options. The functionality works but for some reason every time you click on the field or on the page after clicking away from the page it calls the function the options is binding to which gets called a ridiculous amount of times.

I found someone who has the same issue on stackoverflowhttps://stackoverflow.com/questions/437 ... on-primeng

<p-dropdown [id]="field.Code" [options]="getDataCodes(field)" [formControlName]="Description"></p-dropdown>

getDataCodes() logs to console a message to see how many times it gets hit and returns a list of SelectItem.

Any workaround or a fix in the near future?

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests