Skip to content

Instantly share code, notes, and snippets.

@willrjmarshall
Created January 17, 2014 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willrjmarshall/8469076 to your computer and use it in GitHub Desktop.
Save willrjmarshall/8469076 to your computer and use it in GitHub Desktop.
angular.module("filters", []).filter "truncate", ->
(text, length, end) ->
text = text || ""
length = 10 if isNaN(length)
end = "..." if end is `undefined`
if text.length <= length or text.length - end.length <= length
text
else
String(text).substring(0, length - end.length) + end
angular.module("filters", []).filter "date_in_words", ->
(date) ->
"test"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment