嗨,我想过滤
ng-repeat
价值点击复选框字段。如何在angularjs中点击复选框字段时过滤ng-repeat值?点击
Role block
复选框,它应该只过滤roles
value of block
元素。并就
My role
复选框,单击它应该过滤只有request_role
value of Change agent data's or elements
我的HTML: -
<div ng-repeat="question in users | filter: searchtable | filter: myrole">
<small>
<table border="0">
<tbody>
<th>{{question.displayName}}</th>
<th style="background: yellow;">,{{question.roles[0]}}</th>
<th style="background: light;">,{{question.request_role[0]}}</th>
</tbody>
</table>
</small>
</div>
复选框滤波器输入: -
<input type="checkbox" data-ng-model="searchtable.roles" value="block" ><span>Role block</span>
<input type="checkbox" data-ng-model="myrole.request_role" value="Change Agent" ><span>My role</span>
我的数据: -
$scope.users = [{
"_id": "59a6c7c96c2ce324124cc1d8",
"displayName": "blink foundation",
"provider": "local",
"location": "icf",
"username": "blink",
"dob": "1991-10-04T18:30:00.000Z",
"phone": 7299345250,
"religion": "Hindu",
"college_name": "Arignar Anna",
"__v": 2,
"created": "2017-08-30T14:12:25.397Z",
"roles": [
"block"
],
"request_role": [
"Change Agent"
],
"lastName": "foundation",
"firstName": "blink"
},
{
"_id": "598abfe4cce8ed582a2d8b32",
"displayName": "avinaash muthukumar",
"provider": "local",
"username": "avinaash muthu",
"__v": 0,
"created": "2017-08-09T07:55:16.511Z",
"roles": [
"admin"
],
"request_role": [],
"firstName": "avinaash"
},
{
"_id": "5979a591c999e9302caece13",
"displayName": "Ajmal Afthab",
"provider": "local",
"location": "Urapakkam",
"username": "ajmal_afthab",
"dob": "1995-01-23T18:30:00.000Z",
"phone": 9500269131,
"religion": "Islam",
"__v": 1,
"roles": [
"kp"
],
"request_role": [],
"categories": [
"Religion & Culture",
"Moral Ethics",
"Social Psychology"
],
"lastName": "Afthab",
"firstName": "Ajmal"
},
{
"_id": "5978a2886d5b10ec321a2114",
"displayName": "happy selvam",
"provider": "local",
"username": "happy",
"__v": 0,
"created": "2017-07-26T14:09:12.730Z",
"roles": [
"admin"
],
"request_role": [],
"categories": [],
"lastName": "selvam",
"firstName": "happy"
},
{
"_id": "58e73c5c9e2f3f1421e241be",
"displayName": "sarawana kumar",
"religion": "hindu",
"__v": 2,
"roles": [
"user"
],
"request_role": [],
"categories": [
"Religion & Culture",
"Social Psychology"
],
"lastName": "kumar",
"firstName": "sarawana"
},
{
"_id": "58d0fab62758cc482c295eba",
"displayName": "avinaash kumaran",
"provider": "local",
"username": "avinaash",
"roles": [
"admin"
],
"request_role": [],
"categories": [],
"lastName": "kumaran",
"firstName": "avinaash"
},
]
* My Plunker我正好找上点击复选框ng-module
value
应该在数据的列表中筛选...
感谢您的回答和帮助... –
上面的答案也适用于复选框,您可以从演示中看到。 – Vivz
是的,我看到你的答案,这对我也有用,谢谢,我给你upvote这....谢谢....如果可能请看看这个: - https://stackoverflow.com/questions/45959394/how-to-set-end-date-as-a-current-or-todays-date-in-angularjs –