Skip to content

Commit 32820f9

Browse files
committed
Merge pull request #5 from Reboog711/master
Added the ability to execute methods when the drop down is opened or closed
2 parents db137da + a29cf8f commit 32820f9

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

angular-multi-select.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', fu
5151
orientation : '@',
5252
maxLabels : '@',
5353
isDisabled : '=',
54-
directiveId : '@'
54+
directiveId : '@',
55+
// JH DotComIt Added 5/8/2014
56+
onPopupopen: '&onPopupopen',
57+
onPopupclose: '&onPopupclose'
5558
},
5659

5760
template:
@@ -235,15 +238,21 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', fu
235238
for( i=0; i < checkboxes.length; i++ ) {
236239
if ( i != multiSelectIndex ) {
237240
checkboxes[i].className = 'multiSelect checkboxLayer hide';
241+
// JH DotComIt 5/8/2014 Added method handler for closing the popup
242+
$scope.onPopupclose();
238243
}
239244
}
240245

241246
if ( checkboxes[ multiSelectIndex ].className == 'multiSelect checkboxLayer hide' ) {
242247
checkboxes[ multiSelectIndex ].className = 'multiSelect checkboxLayer show';
248+
// JH DotComIt 5/8/2014 Added method handler for opening the popup
249+
$scope.onPopupopen();
243250
}
244251
else if ( checkboxes[ multiSelectIndex ].className == 'multiSelect checkboxLayer show' ) {
245252
checkboxes[ multiSelectIndex ].className = 'multiSelect checkboxLayer hide';
246-
}
253+
// JH DotComIt 5/8/2014 Added method handler for closing the popup
254+
$scope.onPopupclose();
255+
}
247256
}
248257
}
249258

@@ -359,8 +368,10 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', fu
359368
var checkboxes = document.querySelectorAll( '.checkboxLayer' );
360369
if ( e.target.className.indexOf( 'multiSelect' ) === -1 ) {
361370
for( i=0; i < checkboxes.length; i++ ) {
362-
checkboxes[i].className = 'multiSelect checkboxLayer hide';
363-
}
371+
checkboxes[i].className = 'multiSelect checkboxLayer hide';
372+
// JH DotComIt 5/8/2014 Added method handler for closing the popup
373+
$scope.onPopupclose();
374+
}
364375
e.stopPropagation();
365376
}
366377
});

0 commit comments

Comments
 (0)