bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Dropdown auto-close outsideClick issue when menu items change

Open andrewrindf opened this issue 11 years ago • 3 comments

Hello,

I'm working on creating a dropdown menu that uses an input box to search through that menu. I'm trying to make it so that as the user clicks on options in the menu, they are removed from that menu. I need to make the menu stay open during this process (i.e. be able to remove multiple items from the menu without it closing). Using auto-click="outsideClick" does not work when items are removed from the menu using splice().

I created a minimal reproduce scenario plunkr here: http://plnkr.co/edit/OCNhSxesFd9H0hbN76WH?p=preview

This seems to be a bug; though, perhaps there is another preferred way of doing this.

Thanks, Andrew

andrewrindf avatar Jun 24 '15 20:06 andrewrindf

You should pass $event to your callback in your ng-click and call $event.stopPropagation() in the callback.

Here is an example with this in action.

wesleycho avatar Jun 27 '15 04:06 wesleycho

Awesome. Thanks for your help!

andrewrindf avatar Jun 29 '15 16:06 andrewrindf

you solved my problem, thanks a lot, but why? 难死宝宝了!

kai-up avatar Oct 11 '16 05:10 kai-up