angular ui grid如何在网格中显示html

时间:2013-09-09 14:33:26

标签: javascript angularjs angular-ui ng-grid

我正在尝试在网格中显示html 看着

Add html link in anyone of ng-grid

我最终得到了

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>'}
                    ]
                };
            });  

但它不起作用(href属性为空) 那么正确的方法是什么? 再见

1 个答案:

答案 0 :(得分:2)

在href

中试试

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