【问题标题】:why ellipsis plugin not working in angular为什么省略号插件不能在角度工作
【发布时间】:2015-07-08 09:25:09
【问题描述】:

我正在尝试在我的演示中使用这个插件 https://github.com/STAR-ZERO/jquery-ellipsis 。但是我无法在两行之后添加省略号。请告诉我如何在两行之后添加省略号

这是我的代码:

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

我在行的列中获取数据。当我的列数据超过两行时,我想添加省略号

【问题讨论】:

  • 您链接的插件已弃用。
  • so 如何在 2 行后添加省略号
  • 拜托,即使这是一个与你不同的问题already ask here a few minutes ago...你追求的是同一件事...不要打开两个相同的问题,而是澄清你想要什么并提出one complete question
  • @gmo 你是对的。但是我没有使用插件。但是在这里我使用了插件。但是我没有实现我的目标..:(
  • 这就是我说的原因... 澄清你想要什么并提出一个完整的问题

标签: javascript angularjs angularjs-directive angularjs-scope ionic-framework


【解决方案1】:

如果您不想麻烦地创建过滤器或指令来做同样的事情(我只会在很多地方使用它时才会打扰):

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"
    ]
});

在您的 html 中:

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

您不必使用 DIV。几乎任何标签都可以...

Plunker

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-01
    • 1970-01-01
    • 2012-07-29
    • 2012-10-17
    • 1970-01-01
    • 1970-01-01
    • 2012-05-09
    • 2015-11-23
    相关资源
    最近更新 更多