diff options
author | Steven <isteven@users.noreply.github.com> | 2014-06-05 15:00:22 +0800 |
---|---|---|
committer | Steven <isteven@users.noreply.github.com> | 2014-06-05 15:00:22 +0800 |
commit | 76a2e834257c7d607ea4d88995fc85be311691a7 (patch) | |
tree | 84fcc00aa91aab1cc5860c5794c33c7cf7bb15b7 | |
parent | 3550dfe977a924183643e7a03b401096ae34f26d (diff) | |
parent | bc683e6cca341532da0cc47beae693e69c7d7ffb (diff) | |
download | angular-multi-select-76a2e834257c7d607ea4d88995fc85be311691a7.zip angular-multi-select-76a2e834257c7d607ea4d88995fc85be311691a7.tar.gz angular-multi-select-76a2e834257c7d607ea4d88995fc85be311691a7.tar.bz2 |
Merge pull request #16 from filaruina/develop-option
Allow max-labels 0 (Will only display "(Total: X)" on the button)
-rw-r--r-- | angular-multi-select.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/angular-multi-select.js b/angular-multi-select.js index 33d5c60..dd610f4 100644 --- a/angular-multi-select.js +++ b/angular-multi-select.js @@ -181,9 +181,9 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$ if ( $scope.selectedItems.length === 0 ) { $scope.varButtonLabel = 'None selected'; } - else { + else { var tempMaxLabels = $scope.selectedItems.length; - if ( typeof $scope.maxLabels !== 'undefined' && $scope.maxLabels !== '' && $scope.maxLabels !== "0" ) { + if ( typeof $scope.maxLabels !== 'undefined' && $scope.maxLabels !== '' ) { tempMaxLabels = $scope.maxLabels; } @@ -202,11 +202,15 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$ } ctr++; } - }); + }); if ( $scope.more === true ) { - $scope.varButtonLabel += ', ... (Total: ' + $scope.selectedItems.length + ')'; - }$scope + if (tempMaxLabels > 0) { + $scope.varButtonLabel += ', ... '; + } + + $scope.varButtonLabel += '(Total: ' + $scope.selectedItems.length + ')'; + } } $scope.varButtonLabel = $sce.trustAsHtml( $scope.varButtonLabel + '<span class="multiSelect caret"></span>' ); } |