Open MaccerC opened 6 years ago
I don't know if you still care, but I managed to trim a number of characters with the truncate
and reverse
filters.
$scope.message = 'Hello World'
<p>{{message| reverse | truncate: message.length - 7 | reverse}}</p>
results in "orld", which is the same as removing 7 characters from the left. If you want to remove characters from the right, you can just use truncate
.
<p>{{message | truncate: message.length - 7}}</p>
results in "Hell"
Is it possible to trim a number of characters and not only a certain part of a string?