I am currently using a LimitTo filter to make excerpts of the description of an article to appear on the homepage of a website as a snippet in the feature section.
LimitTo is currently working for say "100 characters" but it gives abruptly ending words in excerpt sometimes, since the 100 character limit ends there.
I want to somehow end the excerpt at the occurrence of the last word (under 100 character limit) or at the occurrence of last space .
{{content.description | limitTo: 100}}{{content.description.length > 100 ? '...' : ''}}
I am using this currently, what can I add or do to make sure the words are complete under the 100 character limit and it doesn't end abruptly before showing the "..."
E.g. When I put "LimitTo: 12" here,
if content.description = "A Terrible Day", the output would be: "A Terrible D..."
but I want this to happen
if content.description = "A Terrible Day", the output would be: "A Terrible..." That is before or at the occurrence of the space.
How can i get the above mentioned output?
I am giving the implementation of pipe transform method here :-