javascript - Unable to filter some value from table using angular.js -


i using roman value(i.e-i,ii,iii,......viii) in table when trying filter table using these value value filtration process happening , value not happening using angular.js. please check code below.

subject.html:

<table class="table table-bordered table-striped table-hover" id="datatable" > <colgroup> <col class="col-md-1 col-sm-1"> <col class="col-md-2 col-sm-2"> <col class="col-md-2 col-sm-2"> <col class="col-md-2 col-sm-2"> <col class="col-md-2 col-sm-2"> <col class="col-md-2 col-sm-2"> <col class="col-md-1 col-sm-1"> </colgroup> <thead> <tr> <th>sl. no</th> <th> <select style="width:100%; border:none; font-weight:bold;" ng-options="sub.name sub in nocourse track sub.value" ng-model="search" ng-change="selectedcoursetable();" > <!-- <option value="">course name</option>--> </select> </th> <th> <select style="width:100%; border:none; font-weight:bold;" ng-options="sem.name sem in nosemesterstable track sem.value" ng-model="semestersearch"> <option value="">semester</option> </select> </th> <th>subject name</th> <th>short name</th> <th>edit</th> </tr> </thead>  <tbody id="detailsstockid"> <tr ng-repeat="sub in subjectdata | filter:{course_name:search.value, semester:semestersearch.value }" > <td>{{ $index+1 }}</td> <td>{{sub.course_name}}</td> <td>{{sub.semester}}</td> <td>{{sub.subject_name}}</td> <td >{{sub.short_name}}</td> <td> <a href='#subject?s_i={{sub.subject_id}}'> <input type='button' class='btn btn-xs btn-green' value='edit'>   </a> </td> </tr>    </tbody> </table> 

for bind data dynamically in table have db operation , inside database roman values stored.check controller file.

subjectcontroller.js:

$http({         method: 'get',         url: "php/subject/readcourse.php",     }).then(function successcallback(response) {         angular.foreach(response.data, function(obj){             var course={'name':obj.course_name , 'value':obj.course_name};             $scope.nocourse.push(course);         });     },function errorcallback(response) {      }); $scope.selectedcoursetable=function(){         if($scope.search.value=='bachelor of technology'){             $scope.nosemesterstable=[             {name:"i",value: "i"},             {name:"ii",value:"ii"},             {name:"iii",value: "iii"},             {name:"iv",value: "iv"},             {name:"v",value:"v"},             {name:"vi",value: "vi"},             {name:"vii",value:"vii"},             {name:"viii",value:"viii"}             ];         }         if($scope.search.value=='master in technology'){             $scope.nosemesterstable=[             {name:"i",value: "i"},             {name:"ii",value: "ii"},             {name:"iii",value:"iii"},             {name:"iv",value:"iv"}             ];         }         if($scope.search.value=='master of computer application'){             $scope.nosemesterstable=[             {name:"i",value:"i"},             {name:"ii",value: "ii"},             {name:"iii",value:"iii"},             {name:"iv",value:"iv"},             {name:"v",value:"v"},             {name:"vi",value:"vi"}             ];         }         if($scope.search.value==''){             $scope.nosemesterstable=null;         }     } 

when selecting value iii onward filtering occurring when selecting i or ii drop down not happening ,all values showing.actually confused issue value filter working value not working.please me resolve issue.

i think way how filter works. match in way using right not strict. think should use sub in subjectdata | filter:{course_name:search.value, semester:semestersearch.value }:true.

notice true value @ end of filter - makes comparison strict.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -