Skip to content

Commit

Permalink
Merge pull request #16 from filaruina/develop-option
Browse files Browse the repository at this point in the history
Allow max-labels 0 (Will only display "(Total: X)" on the button)
  • Loading branch information
isteven committed Jun 5, 2014
2 parents 3550dfe + bc683e6 commit 76a2e83
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions angular-multi-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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>' );
}
Expand Down

0 comments on commit 76a2e83

Please sign in to comment.