Primeng dropdown controls not working after angular 9 update (works with ivy disabled)

UI Components for Angular
Post Reply
mip1983
Posts: 1
Joined: 02 Oct 2017, 15:29

23 Mar 2020, 12:32

**Current behavior**

I have a p-dropdown control bound with ngModel to an object on my component. It's been working fine for a long while, I've just hit this issue after upgrading to angular 9 and the latest primeNG.

```
<p-dropdown
*ngIf="isOwner"
name="project"
[options]="projects"
[optionLabel]="'label'"
[filter]="true"
[(ngModel)]="selectedProject"
[placeholder]="'Select a project'"
required>
</p-dropdown>
```

After the update, this dropdown renders the list of values, but doesn't have the selected value bound (so just shows the placeholder). When I select a value, the control goes to it's invalid state and nothing is bound.

If I move the control outside of the div it's in, which has an ngIf on it, it works perfectly. As soon as I wrap it in an ngIf block or apply an ngIf to it, it stops behaving and doesn't seem to want to model bind. There are no errors in the console.

If I disable ivy completely ("angularCompilerOptions": { "enableIvy": false }), it all starts working fine again.

**Minimal reproduction of the problem with instructions**

This is a strange one and I've not figured out how to reproduce on stackblitz. I've tried here:

https://stackblitz.com/edit/github-455s ... mponent.ts

But it seems to behave in this context. I'm using timeouts to simulate async http requests to simulate the nature of how the data/model is loaded, but not sure if this is effective?

But I've not been able to reproduce it. I can't think what would be different about my app running locally compared to stackblitz. Any ideas or things I could try are welcome.


**Please tell us about your environment:**
Windows 10, VS Code

* **Angular version:** 9.07

* **PrimeNG version:** 9.02

* **Browser:** Chrome

* **Language:** TypeScript 3.8.3

* **Node (for AoT issues):** `node --version` = v12.16.1

bilpor
Posts: 3
Joined: 03 Mar 2020, 16:03

24 Mar 2020, 10:04

Hi,

check out my question viewtopic.php?f=35&t=61439 I have a dropdown there and I have that working. It might help.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests