Using row values in ng-grid column cellTemplate
Asked Answered
S

4

6

I'm trying to add a column that have a link to another page (is an ng-grid table). That link contains one of the values of the row

I tried something like this:

$scope.columns = [
  {field:'id', displayName:'#'},
  {field:'name', displayName:'Name'},
  {field:'view', displayName:'Action', cellTemplate: '<a href="http://foo.com/person/' +  {row.getProperty(col.id)} + '">[View Details]</a>'}
];

But is not working, any ideas?

Severance answered 8/2, 2014 at 15:45 Comment(0)
Q
7

The expression should be

{{row.getProperty(col.id)}}

or

{{row.getProperty(\'id\')}}

Qualls answered 8/2, 2014 at 16:8 Comment(0)
O
2

or you can

{{row.entity[\'id\']}}
Overdress answered 17/10, 2014 at 14:13 Comment(0)
E
0

You can use the ng-grid property COL_FIELD:

{{COL_FIELD}}

For example:

cellTemplate: '<div class="ngCellText">{{COL_FIELD | date}}</div>'
Expatiate answered 10/2, 2015 at 14:22 Comment(0)
C
0

try the below :

cellTemplate : href="https://localhost:8082{{row.entity.ImgLink}}"
Cathey answered 26/5, 2016 at 9:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.