My issue is same with question How to manually toggle angular-ui-select dropdown, but in my case, i just use single select feature.
Generally, I'm using AngularUI's ui-select to create single select on a page. I need to be able to open the dropdown list when a user clicks on a button on the page.
I've tried using jQuery's .click()
, .trigger('click')
but they're not working.
This plunker has been forked with Singe Select Option:
How can I toggle the dropdown manually, from outside the ui-select element's context?
Update:
In this plunker (plnkr.co/edit/7wXP6cSqPaDlvhEbkNau?p=preview), the version of ui-select is 0.9.x, they use the button to active the event, and we can use
$("#"+attrs.openMenuByClick).find('button').click();
(Thank @sdfacre for this help)The new version of ui-select is 0.13.2, they use the
<span>
instead<button>
, so how can I call ng-click function when they use<span>
without using directive?