2

I am trying to use this plugin in my demo https://github.com/STAR-ZERO/jquery-ellipsis . But I am not able to add ellipsis after two line .could you please tell me how to add ellipsis after two row

Here is my code:

  $('.columnCss').ellipsis({
       row: 2,
       onlyFullWords: true
  });

I am getting data in column of row .I want to add ellipsis when my column data is more than two lines

user944513
  • 12,247
  • 49
  • 168
  • 318
  • The plugin you're linking to is deprecated. – Jerska Jul 07 '15 at 10:58
  • so How to add elipsis after 2 line – user944513 Jul 07 '15 at 10:59
  • Please, even if it's a diferent question than you [already ask here a few minutes ago](http://stackoverflow.com/questions/31265257/how-to-add-ellipsis-after-two-lines)... you're after the same thing... don't open two questions about the same, Instead, clarify what you want and make `one complete question` about it. – gmo Jul 07 '15 at 11:01
  • @gmo you are right .But there I didn't use plugin .but here I used plugin .But from both I didnot acheive my goal ..:( – user944513 Jul 07 '15 at 11:04
  • 1
    That's why I'm saying... ***clarify what you want and make one complete question about it*** – gmo Jul 07 '15 at 11:05
  • please check my edited Question .I am getting data from service show in form of table.I want to add ellipsis after two lines if data is more – user944513 Jul 07 '15 at 11:07
  • can do it with css and no need for jQuery – charlietfl Jul 07 '15 at 11:11
  • @charlietfl i tried with css failed to get the output ..I am able when I want to truncate in one line failed when I want to truncate in two line – user944513 Jul 07 '15 at 11:12

1 Answers1

0

Hacky solution if you don't want to go through the trouble of creating a filter or a directive to do the same (I would only bother if it is going to be used many places):

app = angular.module('app', []);
app.controller('testController', function($scope){
    $scope.arrayStrings = [
      "this is the first line of data",
      "this is the second line of data",
      "this is the third line of data"
    ]
});

In your html:

<div ng-repeat="line in arrayStrings" ng-if="$index < 2">{{line}}</div>
<div ng-show="arrayStrings.length > 2">...</div>

You do not have to use DIV's. Pretty much any tag will do...

Plunker

Sina Khelil
  • 2,001
  • 1
  • 18
  • 27