在 AngularJS 中创建阅读更多链接 [英] Create read more link in AngularJS

查看:20
本文介绍了在 AngularJS 中创建阅读更多链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个包含阅读更多文本的链接.如果段落中有超过 3 行,则此链接应该可见,单击此链接会显示所有行.

I want to create a link with read more text. if there are more than 3 lines in a paragraph this link should be visible and clicking on this it show display all the lines.

推荐答案

我想做同样的事情,所以我创建了一个指令.看看这里:https://gist.github.com/doukasd/0744566c5494ebc8643f

I wanted to do the same thing, so I created a directive. Have a look here: https://gist.github.com/doukasd/0744566c5494ebc8643f

用法非常简单:

<p data-dd-collapse-text="100">{{veryLongText}}</p>

其中 100 是您要指定的字符限制.

Where 100 is the character limit you want to specify.

更新: dd-text-collapse

这篇关于在 AngularJS 中创建阅读更多链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆