vitalets / checklist-model

AngularJS directive for list of checkboxes
http://vitalets.github.io/checklist-model
MIT License
1.05k stars 206 forks source link

Doesn't work for arrays of integers #150

Closed andrewlphilpott closed 7 years ago

andrewlphilpott commented 8 years ago

I'm working with some data that includes an array of integers (i.e. [1, 3, 6, 9, 12]) and noticed that checklist-model doesn't work with the data because it's assuming data is strings. I was able to get it to work by adding the following code to the contains, add, and remove functions:

if(!isNaN(item)) {
  item = parseInt(item);
}

Any chance we could get something like this added to the directive?

beradrian commented 7 years ago

Could you please write a PR with tests?

andrewlphilpott commented 7 years ago

Sorry, forgot to come back to this but it looks like someone else created a PR for it: https://github.com/vitalets/checklist-model/pull/157

beradrian commented 7 years ago

PR merged