ng-select icon indicating copy to clipboard operation
ng-select copied to clipboard

allow also number and boolean as value not just string

Open marco1486 opened this issue 8 years ago • 2 comments

please modify the value field of the ioption to also allow number and boolean.

marco1486 avatar Oct 01 '17 14:10 marco1486

I would like to see this as well...most values are the id of the database record and this is an awesome component but currently, I have to add a few extra lines of code for each input to convert the value before giving it to my real model.

anthony-r-martin avatar Oct 10 '17 14:10 anthony-r-martin

I tried implementing this using a generic approach, allowing only string and number (can be expanded to boolean as well): https://github.com/basvandenberg/ng-select/compare/1.0.3...nikeee:feature/allow-string-and-number?expand=1

It should not be a breaking change, as the generic type parameter defaults to string (which is the current behaviour). Also, specifying a specific type for TOptions prohibits pushing different value types for the options.

However, I don't know whether generic components are supported. Also, there might be places with explicit checks for string, which should be extended to also handle the other possibilities.

Would that be an option for this feature @basvandenberg?

nikeee avatar Jan 24 '20 14:01 nikeee