Reputation: 2790
I am reading educational data from facebook and showing it to my page directly. I find some string too long so i want to put ... after certain number of character in angularjs.
ex
jeevan sadhana english medium high school 08
to
jeevan sadha..
Upvotes: 5
Views: 6589
Reputation: 535
I used these three css stylings and it worked for me:
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
Also ensure that the width is fixed (in px or %age).
Upvotes: 0
Reputation: 11
If you want to add ellipses after n number of lines then we can do this using Jquery.dotdot plugin Check this link Adding ellipses after n-bumber of lines in AngularJs
Upvotes: 1
Reputation:
Create filter in angular code.
Working http://jsfiddle.net/tUyyx/
Use filter code give in fiddle.
Then filter your content like :
{{ name | truncate : 25}}
Upvotes: 3
Reputation:
maxLength = 10;
str = str.length > maxLength ? str.substr(0, maxLength) + '...' : str;
Upvotes: 0
Reputation: 2901
There are two possible solutions.
text-overflow: ellipsis;
along with overflow: hidden;
. Obviously, your element will have to be fixed width.Upvotes: 6