twosigma/angular-truncate

Name: angular-truncate

Owner: Two Sigma

Description: truncate text and add ellipses.

Created: 2016-02-17 16:08:12.0

Updated: 2016-02-17 16:08:13.0

Pushed: 2016-02-17 16:19:14.0

Homepage: null

Size: 5318

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Angular Truncate

This project is a filter for Angularjs to truncate text strings to a set number of characters or words and add ellipses when needed.

Demo

How to use angular truncate
Include the javascript file.
ipt src="truncate.js"></script>
Inject the truncate filter into your app module.
myApp = angular.module('myApp', ['truncate']);
When outputting text, apply the filter.

{{ text | characters:25 }} or {{ text | words:5 }}

By default, a word will not be truncated. Set the optional boolean after the character count to true.


 {{ text | characters:25 :true}}
>

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.