Current behavior
The onChange event is not been called.
Expected behavior
onChange callback should be called.
Angular version: 2.0.X
2.4.10
PrimeNG version: 2.0.X
2.0.5
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
Chrome
Language: [all | TypeScript X.X | ES6/7 | ES5]
Typescript
Have the same issue:
<p-dropdown [options]="dropdownAccounts"
[(ngModel)]="selectedAccount"
[style]="{'width':'150px'}"
(onChange)="onAccountSelect">
</p-dropdown>
Angular: 2.4.6
PrimeNG: 2.0.4
I solve the problem, instead of (onChange)="onAccountSelect" should be (onChange)="onAccountSelect($event.value)"
works without $event
<p-dropdown [options]="languages" [(ngModel)]="value" (onChange)="onChange()" [autoWidth]="false">
</p-dropdown>
My (onChange) event gets fired even if I select the same item once again. Technically, it is not a change from the previous selection so this shouldn't happen.
Can somebody verify this?
Can somebody verify this?
yes, (onChange) is fired if I select the same item once again
my code
<p-dropdown [options]="countries" [(ngModel)]="value" (onChange)="onChange()" [autoWidth]="false">
</p-dropdown>
countries.push({label: 'Bitte w盲hlen', value: null});
countries.push({label: 'Deutschland', value: 'DE'});
countries.push({label: '脰sterreich', value: 'AT'});
Thanks @cyberrranger
In this case an issue needs to be raised for this. This behavior is actually not correct and needs to be corrected.
Tracked at #2760
Hello i was wondering if i wanted to fire the onChange event whiel selecting same item how could i do it?
please add a condition and use the findIndex array method based on the index implement the conditional flow of selection code execution
Most helpful comment
works without $event
<p-dropdown [options]="languages" [(ngModel)]="value" (onChange)="onChange()" [autoWidth]="false"> </p-dropdown>