@@ -60,6 +60,7 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$
60
60
tickProperty : '@' ,
61
61
disableProperty : '@' ,
62
62
groupProperty : '@' ,
63
+ maxHeight : '@' ,
63
64
64
65
// callbacks
65
66
onClose : '&' ,
@@ -84,13 +85,11 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$
84
85
'<button type="button" class="clearButton" ng-click="inputLabel.labelFilter=\'\';updateFilter();prepareGrouping();prepareIndex();select( \'clear\', $event )">⨯</button> ' +
85
86
'</div>' +
86
87
'</div>' +
87
- '<div class="checkBoxContainer">' +
88
-
88
+ '<div class="checkBoxContainer" style="{{setHeight();}}">' +
89
89
'<div ng-repeat="item in filteredModel | filter:removeGroupEndMarker" class="multiSelectItem"' +
90
90
'ng-class="{selected: item[ tickProperty ], horizontal: orientationH, vertical: orientationV, multiSelectGroup:item[ groupProperty ], disabled:itemIsDisabled( item )}"' +
91
91
'ng-click="syncItems( item, $event, $index );"' +
92
92
'ng-mouseleave="removeFocusStyle( tabIndex );">' +
93
-
94
93
'<div class="acol" ng-if="item[ spacingProperty ] > 0" ng-repeat="i in numberToArray( item[ spacingProperty ] ) track by $index"> </div>' +
95
94
'<div class="acol">' +
96
95
'<label>' +
@@ -99,9 +98,7 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$
99
98
'</label>' +
100
99
'</div>' +
101
100
' ' +
102
-
103
101
'<span class="tickMark" ng-if="item[ groupProperty ] !== true && item[ tickProperty ] === true">✔</span>' +
104
-
105
102
'</div>' +
106
103
'</div>' +
107
104
'<form>' +
@@ -127,6 +124,13 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$
127
124
helperItems = [ ] ;
128
125
helperItemsLength = 0 ;
129
126
127
+ // If user specify a height, call this function
128
+ $scope . setHeight = function ( ) {
129
+ if ( typeof $scope . maxHeight !== 'undefined' ) {
130
+ return 'max-height: ' + $scope . maxHeight + '; overflow-y:scroll' ;
131
+ }
132
+ }
133
+
130
134
// A little hack so that AngularJS ng-repeat can loop using start and end index like a normal loop
131
135
// http://stackoverflow.com/questions/16824853/way-to-ng-repeat-defined-number-of-times-instead-of-repeating-over-array
132
136
$scope . numberToArray = function ( num ) {
@@ -242,7 +246,8 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$
242
246
return true ;
243
247
}
244
248
break ;
245
- default :
249
+ default :
250
+ return false ;
246
251
break ;
247
252
}
248
253
}
0 commit comments