ng-table icon indicating copy to clipboard operation
ng-table copied to clipboard

How to use angular-translate with ng-table to translate column titles?

Open drcampbell opened this issue 10 years ago • 2 comments

I am dynamically generating a table using ng-table in Angular 1.5.5, and I want to translate the column title $translatePartialLoader from angular-translate, how do I do this? The below, doesn't work and outputs the name of the translation string.

<div ng-controller="TableController as vm"> <table ng-table-dynamic="vm.tableParams with vm.columns" class="table" show-filter="true"> <tr ng-repeat="row in $data"> <td ng-repeat="col in $columns" data-title="{{col.title | translate}}">{{row[col.field]}}</td> </tr> </table> </div>

drcampbell avatar May 31 '16 19:05 drcampbell

Remove the curly brackets from the data-title attribute : data-title="col.title | translate"

Ikkyusan1 avatar Jun 01 '16 10:06 Ikkyusan1

So If I simplify a bit and just have the following: <td ng-repeat="col in $columns" data-title="A Title">{{row[col.field]}}</td I am still not able to overwrite the current title for that column. Do I need to use a template?

drcampbell avatar Jun 01 '16 13:06 drcampbell