'Show word count after three words?

I am calling data from api in angular and it is a multiselect option what I want is if data is more than three words its should show count of remaining entries how can I do this can anyone help?

enter image description here



Solution 1:[1]

If you are using an array you can do something like this in view:

arrayToShow.length > 3 ? arrayToShow.length - 3 : ''

Or, You can use *ngIf

<div *ngIf="arrayToShow.length > 3 "> arrayToShow.length - 3 <>

If it's an object get the keys in the component and show them based on the length of the keys.

If you want to display the counts at multiple places make sure to compute them in component and reuse it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Apoorva Chikara