I am currently trying to relate rules to fields using the 'filter' filter in Angular. You can see an example of this implementation here: http://plnkr.co/edit/dQiv5lRzhQNjXZ6pVdWO?p=preview
The code I am using for this purpose is as follows:
<div ng-repeat="f in fields">
<h4>{{f.id}}</h4>
<li ng-repeat = "rule in rules | filter:{field: {id: f.id} }">
{{rule.name}}
</li>
</div>
Everything works perfectly with single digit ids, but when dealing with double-digit numbers, such as:
$scope.fields = [{id: 1}, {id: 2}, {id: 3}];
$scope.rules = [{name: "A", field: {id: 12, age: 3}}, {name: "B", field: {id: 2, age: 1}}];
The issue arises where the rule with id 12 is matched to both fields with ids 1 and 2, instead of just the field with id 12. Is there a way to resolve this using the default filter, or would it be necessary to create a custom filter?