Skip to content

Commit 1436dc2

Browse files
authored
Merge pull request #132 from jedieboy/modified-version
add total items when select maxsizelabel is true
2 parents 1ce8866 + 9240d78 commit 1436dc2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

projects/multiselect/src/lib/pipes/display-selected-value.pipe.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ export class DisplaySelectedValuePipe implements PipeTransform {
1010
defaultMaxLabelCount: number = 3;
1111
transform(value: any, maxLabelCount: number = this.defaultMaxLabelCount): any {
1212
if (value instanceof Array) {
13+
1314
const collection = [...value];
15+
var total = collection.length;
1416
const condn = collection.length > maxLabelCount;
1517
condn ? (collection.length = maxLabelCount) : null;
1618

17-
return `${collection.map(v => v.name).join(', ')}${condn ? DOTS : ''}`;
19+
return `${collection.map(v => v.name).join(', ')}${condn ? DOTS + ' ('+total+')' : ''}`;
1820
}
1921
return value && value.name;
2022
}

0 commit comments

Comments
 (0)