truncatewords

Shortens a sentence down to the number of words passed as a parameter. If the number of words specified is less than the length of the string, an ellipsis (…) is appended to the sentence and is included in the word count

Input
  • {{ 'Hello world - my name is John Smith' | truncatewords: 2 }}
Output
  • Hello world...