Say I've a simple array
$scope.array=[0,1,3,4,5,6];
and a view component where I want an ng-checked comparing with a vaule that must be in the array
`<ion-checkbox ng-checked="_.indexOf(array,1) !=-1"></ion-checkbox>`
`<ion-checkbox ng-checked="_.indexOf(array,2) !=-1"></ion-checkbox>`
I'm expecting the first checkbox being checked and not the second but they are both checked. Am I doing something wrong? thanks for help
_in your $scope? If not,_is undefined. Why do you (try to) use underscore to do that in the first place? JS arrays have an indexOf method.underscorejsorlodash, when you're using it from the methods in your javascript files it works. But once you're using inside theng-checkedit's looking for something like:$scope._.indexOf(...), if you want to keep using like this you can assign in your controller$scope._ = _;, but I prefer that you write a new method that receives your parameters and use the_inside it.