I'm using primeng 5.2.4 and I'm trying this:
<p-dropdown [options]="months" [(ngModel)]="selectedMonth"
(change)="selectMonth()"></p-dropdown>
The selectMonth method gets called when the page first loads but not on subsequent selections from the drop down list. If I change this to a click event it works (but I get one event when the dropdown is clicked and another when the value is chosen).
Any ideas on what I might be doing wrong? I rolled back to 4.3.0 and see the same behavior.
Thanks!
The primeng dropdown supports an event onChange that can be looked for any change in the drop down
app.component.html
<p-dropdown [options]="cities2" [(ngModel)]="selectedCity2" optionLabel="name" (onChange)="onChange($event)"></p-dropdown>
app.component.ts
onChange(event) {
console.log('event :' + event);
console.log(event.value);
}
This should help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With