2

This is my code

// Code goes here

var app = angular.module('app', ['ui.grid']);

app.controller('MainCtrl', ['$scope', '$log', function ($scope, $log) {


 $scope.gridOptions = {};

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

 $scope.gridOptions.data = [
    {
        "firstName": "Cox",
        "lastName": "Carney",
        "company": "Enormo",
        "employed": true
    },
    {
        "firstName": "Lorraine",
        "lastName": "Wise",
        "company": "Comveyer",
        "employed": false
    },
    {
        "firstName": "Nancy",
        "lastName": "Waters",
        "company": "Fuelton",
        "employed": false
    }
];
}]);
<!doctype html>
<html ng-app="app">
  <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-touch.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-animate.js"></script>
    <script src="http://ui-grid.info/release/ui-grid-unstable.js"></script>
    <link rel="stylesheet" href="http://ui-grid.info/release/ui-grid-unstable.css" type="text/css">
    <link rel="stylesheet" href="main.css" type="text/css">
  </head>
  <body>

<div ng-controller="MainCtrl">
  <div ui-grid="gridOptions" class="grid"></div>
</div>


    <script src="script.js"></script>
  </body>
</html>

This is my plunker:- http://plnkr.co/edit/WFSbpkYv91af3uAbBnIp?p=preview

In the above code display firstname without link format.but i want to display firsname column data in link format.

1 Answer 1

3

Here is an example of cellTemplate that will display the name

cellTemplate:'<a href="http://stackoverflow.com">{{ row.entity.firstName }}</a>'

http://plnkr.co/edit/F5PS4nCzLkywnSzazMNx

Regards, Eric

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

1 Comment

You're welcome. If it's work like this do not hesitate to approve the answer.

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.