I'm trying to build a search input with a dropdown menu attached to it. I have set the menu to close when the input box loses focus.
Problem: When I click on the links inside the dropdown menu, the menu closes even before any events are registered.
// Search input box
<input type="text" ng-blur="lostFocus()" eva-search />
// Dropdown menu
<div class="component-styleWrap"
ng-click="$event.stopImmediatePropagation(); $event.stopPropagation()">
<li>Example Link</li>
<li>Example Link</li>
</div>
If you just want to delay the effects of your call to lostFocus(), then a timeout should be enough.
app.controller("myController", function ($scope, $timeout) {
$scope.lostFocus = function () {
$timeout(function () {
//whatever your code needs to do goes here.
}, 100);
});
});
You shouldn't really need the 100 in there. I just added that to be on the safe side. Try it without the 100 if you can.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments