html - How to get questions length while it has filtered with some value in angular js? -
how question length
while has been filtered other value using angular js?
actually trying filtered question length have used
total no of questions:{{question.length}}
answer it's showing overall questions length like:-4
.if used filter like:
| filter:{status: 'pending'}
there 2 data's showing on table, want show filtered questions length , expecting answer like:2
please @ plunker reference my plunker.
my html:-
<tr ng-repeat="mani in resultvalue=((question) | filter:{status: 'pending'}) "> <td>{{$index + 1}}</td> <td>{{mani.title}}</td> <td>{{mani.upvotes }}</td> <td>{{question.length}}</td> </tr> <tr> <td>sum</td> <td></td> <td>{{resultvalue | sumofvalue:'upvotes'}}</td> <td></td> </tr> </table> <p class="color">total no of questions :{{question.length}} </p> <p>total no of upvotes : {{resultvalue | sumofvalue:'upvotes'}}</p> <p>total no of open eyes of [1 values] : {{resultvalue | sumofvalue:'openeyes'}}</p> <p>total no of open eyes of [0 value] : {{resultvalue | sumofzeros:'openeyes'}}</p>
filter have used :-
filter:{status: 'pending'})
my data:-
$scope.question = [ { "_id": "5936a70095e3a85804aae050", "user": { "_id": "58072aba0f82a61823c434df", "displayname": "table 1", "roles": [ "admin" ], "profileimageurl": "./modules/users/client/img/ownprofile/uploads/1f08308f43b0674d61a2cc5d95deb5ef", "email": "ms@e21designs.com", "categories": [] }, "__v": 1, "status": "pending", "openeyers": ["sarawana@gmail.com"], "openeyes": 1, "upvoters": [ "sarawana@gmail.com" ], "upvotes": 1, "title": "what cricket", "created": "2017-06-06t12:58:40.204z" }, { "_id": "5979a913c999e9302caece15", "user": { "_id": "58072aba0f82a61823c434df", "displayname": "karthi", "roles": [ "admin" ], "profileimageurl": "./modules/users/client/img/ownprofile/uploads/1f08308f43b0674d61a2cc5d95deb5ef", "email": "karthi@e21designs.com", "categories": [] }, "__v": 1, "status": "approved", "openeyers": [], "openeyes": 0, "upvoters": [ "sarawana@gmail.com" ], "upvotes": 1, "title": "who fan are", "created": "2017-06-06t12:58:40.204z" }, { "_id": "5936a70095e3a85804aae050", "user": { "_id": "58072aba0f82a61823c434df", "displayname": "table 1", "roles": [ "admin" ], "profileimageurl": "./modules/users/client/img/ownprofile/uploads/1f08308f43b0674d61a2cc5d95deb5ef", "email": "karthi@e21designs.com", "categories": [] }, "__v": 1, "status": "pending", "openeyers": [], "openeyes": 0, "upvoters": [ "ms@e21designs.com", "vp@gmail.com" ], "upvotes": 2, "title": "best of day", "created": "2017-06-06t12:58:40.204z" }, { "_id": "5979a913c999e9302caece15", "user": { "_id": "58072aba0f82a61823c434df", "displayname": "karthi", "roles": [ "admin" ], "profileimageurl": "./modules/users/client/img/ownprofile/uploads/1f08308f43b0674d61a2cc5d95deb5ef", "email": "ms@e21designs.com", "categories": [] }, "__v": 1, "status": "approved", "openeyers": ["ms@e21designs.com"], "openeyes": 1, "upvoters": [ "ms@e21designs.com", "vp@gmail.com","ms@gmail.com" ], "upvotes": 0, "title": "he best", "created": "2017-06-06t12:58:40.204z" }, ]
- expecting total no of question like:-
2
, please check plunker , update solution well, thanks
update question length code this:
<p class="color">total no of questions :{{((question) | filter:{status: 'pending'}).length}} </p>
wiki
Comments
Post a Comment