Followed steps as per https://www.npmjs.com/package/ng-multiselect-dropdown for angular 9
received below error in browser console
TypeError: Cannot read property 'idField' of undefined
I had the same issue and I solved but moving [settings]
param prior to [data]
para.
Example:
<ng-multiselect-dropdown
[settings]="dropdownSettings"
[data]="dropdownList"
[(ngModel)]="selectedItems"
>
</ng-multiselect-dropdown>
Please set
dropdownSettings:IDropdownSettings = {
..Other settings,
idField: 'id',
textField: 'text'};
set your dropdown list as
dropdownList= [{id: '1', text: 'Sample Text'}, ..]
Also set [settings] before [data] in html as indicated by Abraham Cm
yes, solution above (with [settings] binding before [data]) works because ng-multiselect-dropdown has setters in data and settings inputs. data setter is using settings input. So in this case order is important. It also suprised me at the beginning. Look at source code:
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