Skip to content

Instantly share code, notes, and snippets.

@andresmatasuarez
Created December 3, 2014 21:06
Show Gist options
  • Save andresmatasuarez/5d4adad758f09d9873f7 to your computer and use it in GitHub Desktop.
Save andresmatasuarez/5d4adad758f09d9873f7 to your computer and use it in GitHub Desktop.
AngularJS | Filter | Replace exceeding characters in a string with '...'
'use strict'
app = angular.module 'app'
app.filter 'threeDots', ($filter) ->
(value, maxLength) ->
if value.length > maxLength
$filter('limitTo')(value, maxLength).trim() + '...'
else
value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment