@@ -49,6 +49,7 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$
49
49
tickProperty : '@' ,
50
50
disableProperty : '@' ,
51
51
orientation : '@' ,
52
+ defaultLabel : '@' ,
52
53
maxLabels : '@' ,
53
54
isDisabled : '=' ,
54
55
directiveId : '@' ,
@@ -179,11 +180,11 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$
179
180
180
181
// Write label...
181
182
if ( $scope . selectedItems . length === 0 ) {
182
- $scope . varButtonLabel = 'None selected' ;
183
+ $scope . varButtonLabel = ( $scope . defaultLabel ) ? $scope . defaultLabel : 'None selected' ;
183
184
}
184
- else {
185
+ else {
185
186
var tempMaxLabels = $scope . selectedItems . length ;
186
- if ( typeof $scope . maxLabels !== 'undefined' && $scope . maxLabels !== '' && $scope . maxLabels !== "0" ) {
187
+ if ( typeof $scope . maxLabels !== 'undefined' && $scope . maxLabels !== '' ) {
187
188
tempMaxLabels = $scope . maxLabels ;
188
189
}
189
190
@@ -202,11 +203,15 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$
202
203
}
203
204
ctr ++ ;
204
205
}
205
- } ) ;
206
+ } ) ;
206
207
207
208
if ( $scope . more === true ) {
208
- $scope . varButtonLabel += ', ... (Total: ' + $scope . selectedItems . length + ')' ;
209
- } $scope
209
+ if ( tempMaxLabels > 0 ) {
210
+ $scope . varButtonLabel += ', ... ' ;
211
+ }
212
+
213
+ $scope . varButtonLabel += '(Total: ' + $scope . selectedItems . length + ')' ;
214
+ }
210
215
}
211
216
$scope . varButtonLabel = $sce . trustAsHtml ( $scope . varButtonLabel + '<span class="multiSelect caret"></span>' ) ;
212
217
}
@@ -444,7 +449,7 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$
444
449
445
450
if ( e . type === 'click' || e . type === 'touchend' && $scope . scrolled === false ) {
446
451
var checkboxes = document . querySelectorAll ( '.checkboxLayer' ) ;
447
- if ( e . target . className . indexOf ( 'multiSelect' ) === - 1 ) {
452
+ if ( e . target . className . indexOf === undefined || e . target . className . indexOf ( 'multiSelect' ) ) {
448
453
for ( i = 0 ; i < checkboxes . length ; i ++ ) {
449
454
checkboxes [ i ] . className = 'multiSelect checkboxLayer hide' ;
450
455
}
0 commit comments