0

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

2
  • I'm wondering why -1 ! the other reply doesn't work ! Commented Sep 9, 2013 at 17:50
  • I always use ng-href in place of href if there is angular in the URL...see the ngHref doc Commented Sep 25, 2013 at 19:07

1 Answer 1

2

Try this in href

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

Sign up to request clarification or add additional context in comments.

2 Comments

It works like a charme :) thanks with just a little escape row.getProperty(\'age\')
Great, i fixed my answer too :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.