question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

items.map is not a function

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
chriszichriszcommented, Sep 30, 2018

If you load the data from a server add the async pipe, setTimeout works, but it seems a bit hacky.

[items]="data | async"

0reactions
FelipeFelizardocommented, Sep 17, 2018

Got same problem here

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found