简体   繁体   中英

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

在href中尝试这个

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM