Answer the question
In order to leave comments, you need to log in
How to set filter through checkbox by key in angularjs?
Found how to set a filter by key
<tr data-ng-repeat="hotel in hotels | filter:{'name':'Вася'} ">
Vasya is looking for, it works, but if I set it through the CheckBox<tr data-ng-repeat="hotel in hotels | filter:{'name':e2} ">
<input type="checkbox" data-ng-model='e2' data-ng-true-value='Вася' data-ng-false-value='' />
it doesn't look for anything. Answer the question
In order to leave comments, you need to log in
If you create your own filter, you can specify the key
app.filter('filterMaterials', function () {
return function (materials, wood, plastic) {
var filteredMaterials = [];
for (var i = 0; i < materials.length; i++) {
if (materials[i].type === wood || materials[i].type === plastic) {
filteredMaterials.push(materials[i]);
}
}
return filteredMaterials;
};
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question