items.map is not a function
See original GitHub issueI have in my html:
<ng-select #unidadesMedicas bindLabel="nombre" bindValue="id" [items]="unidadesMedicas" [placeholder]="'Seleccionar'" [clearable]="false"></ng-select>
At the beginning I have an empty array:
public unidadesMedicas = new Array<any>()
So, when I load my component (where ng-select is) throws an error related to: items.map is not a function
PD. The view renders good but I don’t see my items in the ng-select.
But I don’t a understand why. I think, ng-select internally doesn’t take the array.
More Info
ng-select version: 1.5.2
browser: Chrome
reproducible in demo page: No
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
TypeError: items.map is not a function , how to solve this error
All Json data are not array. Just check the data that you are trying to pass to the map function. Map functions take...
Read more >TypeError: map() is not a function in React | bobbyhadz
The "TypeError: map is not a function" occurs when we call the map() method on a value that is not an array. To...
Read more >How To Fix object.map is not a function Error in JavaScript
The cause of your error is actually quite simple: the .map() method is only applicable when working with arrays. More specifically, the method ......
Read more >TypeError Handling in React.js for Map Function | Pluralsight
This error occurs because your data is not an array. The .map() function only works with arrays. First, you'll need to confirm your...
Read more >map is suddenly not a function? - JavaScript
This error is usually due to the fact that .map() is an array method, and does not work with other data types like...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you load the data from a server add the
async
pipe,setTimeout
works, but it seems a bit hacky.[items]="data | async"
Got same problem here