AngularJS ui-grid render hyperlink

I am using Angular ui-grid 2.0.12, is it possible to add a hyperlink inside this cell or, if you like, any type of html code? I am trying to follow this advice: Add an html link to any of the ng-grid , although it does not seem to work on the u-grid, probably because the ng-grid is used to behave differently or because that the syntax is different now.

+7
angularjs angular-ui-grid
source share
2 answers

Actually, cellTemplate works the same in ui-grid as it does in ng-grid.

 $scope.gridOptions.columnDefs = [ { name: 'firstName' }, { name: 'lastName'}, { name: 'Hyperlink', cellTemplate:'<div>' + '<a href="http://stackoverflow.com">Click me</a>' + '</div>' } ]; 

Working demo (open the links in a new tab because plunker can't handle SO awesomeness)

+36
source share

A small change for dynamic links:

 $scope.gridOptions.columnDefs = [ { name: 'Hyperlink', cellTemplate:'<div><a ng-href="{{row.entity.hyperlink]}}">Click me</a></div>' } ]; 

http://plnkr.co/edit/gDVUBwHolPnEatOrtt26?p=preview

+1
source share

All Articles