What I want to do
I want to be able to work out how much of a string is shown before it is truncated.
Why I want to do it
I have a list of items. You can select any amount of items from this list. I have a panel element that shows a comma separated string of the selected selected item names. If the string is too long, it should be truncated and display a +{number} value of any additional selected items hidden by the truncate.
Basic example
https://stackblitz.com/edit/angular-ivy-cbyemy
The stackblitz above shows a basic example of the use case.
Currently panel title:
an item, another item, som... +6
Desired result:
an item, another item, som... +3
What I have tried
- Using element.innerHTML and element.innerText to read the displayed string. both show the full string, not the displayed truncated string.