The issue is the repeating of checkboxes. This is a snippet of the code in question.
<div class="row">
<label data-ng-repeat="x in projects">
<input
type="checkbox"
data-ng-true-value="{{x.b}}"
data-ng-false-value=''
ng-model="quer[queryBy]" />
{{x.b}}
</label>
</div>
This does what I want in producing checkboxes according to the repeated data to filter a table but the data in the label on occasion holds the same information in 'b'. How do I make it so I get only a single checkbox for a single common input.
Some context. This would create two checkboxes labelled '123', I only want one.
$scope.projects = [
{
a : "G",
b : "123",
c : "S1",
{
a : "R",
b : "456",
c : "S2",
},
{
a : "G",
b : "123",
c : "S3",
},
];
答案 0 :(得分:1)
Try to use this angular extension: https://github.com/a8m/angular-filter
Then adjust your ng-repeat as following:
<label ng-repeat="x in projects | unique:'b'">