I understand this sort of questions have already been answered. But there is something I am stuck at.
My JSON data looks like:
[{
"batch_queue_name": "Batch One",
"start_date": "12/01/2016 10:18 P.M.",
"end_date": "12/03/2016 01:08 A.M.",
"completion_status": "100"
}, {
"batch_queue_name": "Batch Two",
"start_date": "12/10/2016 12:18 A.M.",
"end_date": "12/11/2016 05:23 P.M.",
"completion_status": "100"
}, {
"batch_queue_name": "Batch Three",
"start_date": "04/01/2017 12:18 A.M.",
"end_date": "06/01/2017 03:21 P.M.",
"completion_status": "60"
}, {
"batch_queue_name": "Batch Four",
"start_date": "05/01/2017 01:25 A.M.",
"end_date": "06/01/2017 12:30 A.M.",
"completion_status": "97"
}, {
"batch_queue_name": "Batch Five",
"start_date": "05/01/2017 12:18 A.M.",
"end_date": "08/01/2017 03:37 A.M.",
"completion_status": "42"
}, {
"batch_queue_name": "Batch Six",
"start_date": "16/10/2016 12:18 A.M.",
"end_date": "18/10/2016 05:23 P.M.",
"completion_status": "100"
}]
Now, in my ng-repeat
I am trying to filter those which do not have a completion status of 100:
<tr ng-repeat="batch in vm.batches | filter: {batch.completion_status:'!'+'100'}">
<td> ... </td>
</tr>
But this throws an error:
Syntax Error: Token '.' is unexpected, expecting [:] at column 28 of the expression [vm.batches |NaNilter: {batch.completion_status != '100%'}] starting at [.completion_status != '100%'}].
What am I doing wrong?
You don't have to write batch.completion_status
. You can do it like this:
ng-repeat="batch in batches | filter: {completion_status: '!100'}"