I am using a custom directive for multiSelect dropdown. I needed a custom tirggering of open and close the multiSelect list using a custom button.
Problem: I got $apply already in progress error
Solution: To solve this I wrapped my jQuery function in $timeout
$timeout(function () {
$('button.dropdown-toggle').trigger('click');
});
However, now I could make custom click to directive and my multiSelect would open, but now if on 2nd click I want to close the select box, it flickers, and keeps open. ;(
Directive:
if (!parentFound) {
$scope.$apply(function(){
$scope.open = false;
});
}
Can someone propose a solution so that my toggling of multiSelect dropdown works now (after using $timeout) instead of opening only in all clicks?
