I have data sets for class, batch and users. The user data set contains name,email,class and batch. Class and batch contains list of classes and batches. I want to do search in the user data set using name,email,batch and class. Name and username is provided inside same text field while class in one select option and batch in another select option,all these input fields are defined inside an object and this object is given as filter in ng-repeat.
This is my js
this.autorun(() => {
$scope.dataSet = Meteor.users.find({}).fetch()
$scope.searchFilter = [{
"name": "Class",
"data": self.classe,
"enabled": true,
"label": "class"
}, {
"name": "Batch",
"data": self.batchs,
"label": "batch"
}]
$scope.filterObj = {}
i = 0
_.each($scope.searchFilter, function(filter){
if(!$scope.search){
$scope.search = []
}
$scope.filterObj[filter.label] = $scope.search[i]
i++
})
//$scope.filterObj['name'] = $scope.word
and this is my html
<md-card flex="30" flex-xs="100" flex-sm="45" flex-gt-xs="30" layout-wrap ng-repeat="names in dataSet|filter:filterObj" class="cardfilter textWrap">
<div layout="row">
<div class="md-media-sm card-media"><img src="images/icons/student_profile.png" class="imageFilter"></div>
<div>
<p class="searchBold">{{names.name}}--{{names.class}}--{{names.batch}}
</p>
<p class="searchColor">{{names.username}}</p>
<p></p>
</div>
Can somebody figure out what is wrong with my code?