How to bind title attribute value in ng-table

All we need is an easy explanation of the problem, so here it is.

I am using ng-table to display all values in a table view. Message to be displayed in remarks column (last column of the table) is huge. So, I am displaying few character. When user hovers over the cells I want to show the entire message in a tool-tip. I tried to set it in title attribute, but it’s not working.

Sample code :

<table ng-table="tableParams" class="table">
        <tr ng-repeat="doc in $data">
        <td data-title="'#'" sortable="doc_name">{{$index + 1 }}</td>
        <td data-title="'Visa Type'" sortable="'type'">{{doc.type}}</td>
        <td data-title="'Country'" sortable="'country'">{{}}</td>
        <td data-title="'Starting Date'" sortable="'start_date'">{{doc.start_date}}</td>
        <td data-title="'Expired Date'" sortable="'end_date'">{{doc.end_date}}</td>
        <td data-title="'Remarks'" sortable="'remarks'" title="{{doc.remarks}}">
        {{doc.remarks | limitTo: 15 }} {{doc.remarks.length > 15 ? '...' : ''}}

Please suggest me how to show tool-tip using HTML title attribute.

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

I think you can use the ng-attr-title for that, so basicly your code remains the same, but just before ‘title=’ you add ‘ng-attr-‘. So your last line would like like: <td data-title="'Remarks'" sortable="'remarks'" ng-attr-title="{{doc.remarks}}">

I haven’t tested this on table cells before, but theoretically it should do the trick 🙂


See this working plunkr:

As you can see I made ng-table.js local, and then in index.html I put the ng-attr-title in front of the ng-table attributes.

Method 2

Solution 1:
Using plugin [‘ui-bootstrap’].

You can use below code:


    <link rel="stylesheet" href="" rel="nofollow noreferrer noopener">
     <link rel="stylesheet" href="style.css" rel="nofollow noreferrer noopener" rel="nofollow noreferrer noopener">
    <script src=""></script>
    <script src=""></script>

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

<body ng-app="myApp">
    <table class="table" ng-controller="ctrl">
                    <span tooltip="that">this</span>
            <tr ng-repeat="foo in bar">
                <td><span tooltip="{{foo.tooltip}}">{{foo.content}}</span></td>

And in script file:

// Code goes here

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

app.controller('ctrl', ['$scope', function ($scope) {
    $ = [];
    // doing something async (exec time simulated by setTimeout)
    myAsyncFunc(function (bar) {

        $scope.$apply(function() {
             $ = bar;


var myAsyncFunc = function (done) {
    // simulate some kind of timeout due to processing of the function
    setTimeout(function () {
        return done([{tooltip: 'this is the tooltip', content: 'this is the content'}]);
    }, 500);

here is the link for working plunker Click Here

Solution 2: (Without dependency injection)

Using Directive:


 <link rel="stylesheet" href="style.css" rel="nofollow noreferrer noopener" rel="nofollow noreferrer noopener">
 <link rel="stylesheet" href="" rel="nofollow noreferrer noopener">
      <script src=""></script>
<script src=""></script>
<!-- Latest compiled and minified JavaScript -->
<script src=""></script>
<!-- Latest compiled and minified CSS -->
<script src="script.js"></script>

 <div ng-app="myApp">
    <div ng-controller="MyCtrl">
        <li ng-repeat="item in items" >
            <a rel="tooltip" tooltip="item.tooltip">{{}}</a>

Script part:

var myApp = angular.module("myApp", []);

function MyCtrl($scope) {
    $scope.items = [{ name: "item 01", tooltip: "This is item 01 tooltip!"},
                    { name: "item 02", tooltip: "This is item 02 tooltip!"},
                    { name: "item 03", tooltip: "This is item 03 tooltip!"},
                    { name: "item 04", tooltip: "This is item 04 tooltip!"},
                    { name: "item 05", tooltip: "This is item 05 tooltip!"} ];

    myApp.directive('tooltip', function () {
        return {
            link: function(scope, element, attrs)
                    .tooltip({placement: "right"});

Link for Plunker for this solution Plunker

I have applied it on your code. Please see this plunker

As per your requirement, using ng-attr-title find the link of plunker

Method 3

html has a element: <abbr>

<abbr title="{{doc.remarks}}">
{{doc.remarks | limitTo: 15 }} {{doc.remarks.length > 15 ? '...' : ''}}

It can display the ‘title’ of content when the mouse is moved on ”
if you need it,you can use it.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply