How to Center Align ng-Table Header?

ggn979 picture ggn979 · Mar 18, 2015 · Viewed 20.5k times · Source

All , I am using ng-table for the Grid. I am using following code snippet to set the column .

enter image description here

But I am not able to center align the Column Header but column data.

Here is the source code snippet for Access ID Header.

<th ng-repeat="column in $columns" ng-class="{ 'sortable': parse(column.sortable), 'sort-asc': params.sorting()[parse(column.sortable)]=='asc', 'sort-desc': params.sorting()[parse(column.sortable)]=='desc' }" ng-click="sortBy(column, $event)" ng-show="column.show(this)" ng-init="template=column.headerTemplateURL(this)" class="header  sortable"> <!-- ngIf: !template --><div ng-if="!template" ng-show="!template" ng-bind="parse(column.title)" class="ng-binding ng-scope">Access ID</div><!-- end ngIf: !template --> <!-- ngIf: template --> </th>

Question is , How to center align the Header for a particular column in ng-table?

Answer

radius picture radius · Aug 24, 2015

The answer submitted by @OpenUserX03 is almost perfect, except you have to wrap the class name in single quotes, like so:

<td data-title="'Access ID'" sortable="'accessID'" style="width:120px" class="text-center" header-class="'text-center'">{{people.accessID}}</td>