I'm trying to create checkbox for ng-repeat list. I'm facing some issues.
HTML
<input type="text" ng-model="findname" placeholder="Search Name" />
<ul>
<li class="no-decoration" ng-repeat="tech in technologyArray">
<label>
<input type="checkbox" ng-model="tech.on" />{{tech.u_proffession}}
</label>
{{tech.on}}
</li>
</ul>
<ul>
<li ng-repeat="stu in students | filter:findname | filter:myFunc ">
<strong>Name :{{stu.u_name}}</strong><br />
</li>
</ul>
JS
var ngApp = angular.module('angapp',[]);
ngApp.controller('angCtrl',function($scope,$http){
$scope.myFunc = function(a) {
for(tech in $scope.technologyArray){
var t = $scope.technologyArray[tech];
if(t.on && a.technology.indexOf(t.u_proffession) > -1){
return true;
}
}
};
$scope.technologyArray = [{ u_proffession: "developer", on: false}, {u_proffession:"driver", on:false}];
$http.get("data.php").then(function(response) {
$scope.students= response.data.records
});
});
JSON ARRAY
{"records":[{"u_name":"adrian","u_mail":"[email protected]","u_proffession":"developer"},{...}]}
1000 Rows
The simple search ng-model="findname" is working fine when i remove the checkbox filter inside the ng-list | filter:myFunc. But when i add both of them in ng-list then no data showing in student list and also text search does not working. I wanted to use both of them.
Can anyone guide me where i'm wrong that i can fix my issue. I would like to appreciate if someone guide me. Thank You.