Here is the current section of TH-Tags in the view:
...
<th>
<a href="" ng-click="sortReverse = !sortReverse; order('fname',sortReverse)">
Firstname
<span ng-show="sortType=='fname' && !sortReverse" class="glyphicon glyphicon-triangle-bottom"></span>
<span ng-show="sortType=='fname' && sortReverse" class="glyphicon glyphicon-triangle-top"></span>
</a>
</th>
...
That was my initial solution, but it does not seem to work as expected:
<th ng-repeat="tblOpt in tableOptions">
<a href="" ng-click="sortReverse = !sortReverse; order({{ tblOpt.sortTypeVal }},sortReverse)">
{{ tblOpt.columnTitle }}
<span ng-show="sortType=={{ tblOpt.sortTypeVal }} && !sortReverse" class="glyphicon glyphicon-triangle-bottom"></span>
<span ng-show="sortType=={{ tblOpt.sortTypeVal }} && sortReverse" class="glyphicon glyphicon-triangle-top"></span>
</a>
</th>
Ctrl:
var orderby = $filter('orderBy');
/*Sorting the columns*/
$scope.order = function (sortType, sortReverse) {
$scope.nameslist = orderby($scope.nameslist, sortType, sortReverse);
};
/*Definition for TH-tags*/
$scope.tableOptions = [
{
columnTitle: 'Firstname',
sortTypeVal: 'fname'
},
...
]
I aim to include the description in my Ctrl as shown above in the example. Moreover, the glyphicons are not being displayed in the TH-Tags.