Original text

$scope.longText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla semper augue vel scelerisque egestas. Praesent odio lacus, porta vitae nisl a, semper tempor elit. Etiam fringilla ut nisl non dictum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis eros euismod, elementum tortor ut, sagittis felis. Nulla lectus ante, eleifend non felis pharetra, porta aliquet urna. Curabitur nec elit sit amet tortor accumsan volutpat sed vitae ante. Cras semper consequat nunc, in tincidunt dolor scelerisque eget. Morbi volutpat quis est bibendum aliquet. Sed euismod neque nisl, congue fermentum eros sagittis sit amet. Nulla at tincidunt nibh.";

Char-based truncation

Use the ng-text-truncate directive along with the ng-tt-chars-threshould attribute for truncating your text according to the number of chars in the string.

So, this block...

<p ng-text-truncate="longText"
   ng-tt-chars-threshold="40"></p>

...produces this:

Word-based truncation

Similarly the last example, use the ng-text-truncate directive along with the ng-tt-words-threshould attribute for truncating your text based on the number of words in the string.

So, this block...

<p ng-text-truncate="longText"
   ng-tt-words-threshold="15"></p>

...produces this:

Custom toggling elements

You can set your own labels for the toggling elements using the ng-tt-more-label and ng-tt-less-label attributes.

<p ng-text-truncate="longText"
   ng-tt-chars-threshold="40"
   ng-tt-more-label="Show"
   ng-tt-less-label="Hide"></p>

Text truncation without toggling

You can also truncate the text and ommit the toggling elements by addind the attribute ng-tt-no-toggling.

<p ng-text-truncate="longText"
   ng-tt-words-threshold="15"
   ng-tt-no-toggling></p>

The previous statement produces this: