Answers for "ngmodel not working in ng-select"

3

ngmodel not working in ng-select

//Saved me alot of stress this one. TLDR check bindValue

It depends on the type of schoolsArray. In your case, I guess, schoolsArray is a list of objects, while ngModel is an array of strings. ng-select doesn't know how to map strings from ngModel to objects from items.

Please see documentation for property bindValue to inform ng-select how to bind items keys to the model. https://github.com/ng-select/ng-select

To summarize, add bindValue="id-property-name-in-items" to ng-select tag.
Posted by: Guest on March-16-2022

Browse Popular Code Answers by Language