I'm learning Angular. The below code dynamically shows/hides rows of a table based on a <select multiple> control.
The code works but I wonder if there is a way to convert the expression in data-ng-if to a filter expression without creating a custom filter. Also not sure which is a better approach performancewise.
<select id="psgs" data-ng-model="ctrl.showSubGroups"
ng-options="item.id as item.name group by item.productGroup.name for item in ctrl.productSubGroupList"
multiple>
</select>
<tr
data-ng-if="ctrl.showSubGroups.indexOf(product.productSubGroup.id) > -1"
data-ng-repeat="product in ctrl.productList | filter: ??? | orderBy: ctrl.seq">
...
</tr>
ng-if, but as a filter expression.ng-if="$even", can filter out odd result.It all depends on your use case. If you have a particular requirement, state it in question.