I'm having some difficulty sorting a dynamic Angular table.
If I hard-code the table headers, it works. Fiddle: https://jsfiddle.net/xgL15jnf/
<thead>
<tr>
<td>
<a href="#" ng-click="sortType = 'id'; sortReverse = !sortReverse">id
<span ng-show="sortType == 'id' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
<span ng-show="sortType == 'id' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
</a>
</td>
<td>
<a href="#" ng-click="sortType = 'name'; sortReverse = !sortReverse">name
<span ng-show="sortType == 'name' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
<span ng-show="sortType == 'name' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
</a>
</td>
<td>
<a href="#" ng-click="sortType = 'cost'; sortReverse = !sortReverse">cost
<span ng-show="sortType == 'cost' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
<span ng-show="sortType == 'cost' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
</a>
</td>
</tr>
</thead>
But, if I build the headers dynamically, it does not. Fiddle: https://jsfiddle.net/m31d00sz/
<thead>
<tr>
<td ng-repeat="column in cols">
<a href="#" ng-click="sortType = '{{column}}'; sortReverse = !sortReverse">{{column}}
<span ng-show="sortType == '{{column}}' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
<span ng-show="sortType == '{{column}}' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
</a>
</td>
</tr>
</thead>
The Search/Filter works in both Fiddles.
I'm hoping I'm overlooking something simple, and would appreciate if someone could take a look and provide some guidance!