DEV Community

JWP
JWP

Posted on

1 1

ng-select Filtering Internals!

Sometimes, we as developers loose a lot of time because we don't know the internals of the components we are using and the documentation is very poor.

So we just have to dig in and figure it out.

NG-Select

This is the StackOverFlow question and answer I created on ng-select internals related to filtering the infamous 'no items found' message when typing in letters in the dropdown list.

I believe this was a challenge due to the fact our list was not a simple string list, it was an object with many properties...

This is how it was solved.

dropsown

I have a ng-select component whose drop-down items look like this image above.

In an attempt to filter the list, I type in characters into the input control and see this: "No Items Found" despite the fact they are in the list.

enter image description here

Here's what I've done to try to figure…

Jwp2020

Top comments (0)

typescript

11 Tips That Make You a Better Typescript Programmer

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!