Whisher
Whisher

Reputation: 32806

angular ui grid how to display html in the grid

I'm trying to display html in the grid looking at

Add html link in anyone of ng-grid

I ended up with

var app = angular.module('myApp', ['ngGrid']);
            app.controller('MyCtrl', function($scope) {
                $scope.myData = [
                        {name: "Moroni", age: 50},
                        {name: "Tiancum", age: 43},
                        {name: "Jacob", age: 27},
                        {name: "Nephi", age: 29},
                        {name: "Enos", age: 34}
                    ];
                $scope.gridOptions = { 
                    data: 'myData',
                    columnDefs: [
                        {field: 'name', displayName: 'Name'}, 
                        {field:'age', displayName:'Age'}, 
                        {field: 'remove', displayName:'', cellTemplate: '<div class="ngCellText" ng-class="col.colIndex()"><a href="{{row.getProperty(age)}}">Visible text</a></div>'}
                    ]
                };
            });  

but it doesn't work (the href attribute is empty) so what's the right way ? Bye

Upvotes: 0

Views: 3538

Answers (1)

Chandermani
Chandermani

Reputation: 42669

Try this in href

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

Upvotes: 2

Related Questions