Reputation: 13462
So I have a dropdown..
<select ng-model="dropdown">
<option ng-value="1">1</option>
<option ng-value="2">2</option>
<option ng-value="all">All</option>
</select>
and a table..
<table>
<tr ng-repeat="d in data">
<td ng-bind="d.number"></td> // 0 or 1
<td>Other TD's</td>
<td>Other TD's</td>
</tr>
</table>
What I wanted to do is to when I select for example number 2
in the dropdown, all other rows in the table will be hidden except the row with ng-bind="d.number"
that is equal to 2
.
So what I tried so far is this
<table>
<tr ng-repeat="d in data" ng-if="d.number == dropdown">
<td ng-bind="d.number"></td> // 0 or 1
<td>Other TD's</td>
<td>Other TD's</td>
</tr>
</table>
But when I select all
in the dropdown, the table is empty already.
Is there a cleaner way to do this? Thanks in advance.
Upvotes: 0
Views: 438