javascript - How to manually toggle angular-ui-select dropdown -


I am using the UI-selection of an EngineeringUse to create multiple multisllects on one page. When the user clicks a button on the page then I need to be able to open the dropdown list.

I have tried to use jQuery's .click () and . Toggle element ('click') , but in these results $ is already in progress error when called by the button's ng-click function Although they call from the console of Chrome, the task in ng-click does nothing other than simulating the second click.

. Focus () does nothing input.

I also reluctantly tried a dirty hack, where I use the selector's ng-init to reach a controller in a radius, in which the access to the button , And then the controller toggle () and active () methods it has focused on input, but the associated dropdown list should not be open.

How can I toggle the dropdown manually outside the context of the UI-selection element?

I have tried and instructions can be obtained by the method. Working

  Angular Modules ('myApp', ['ngSanitize', 'ui.select']). Controller ('testController', function ($ scope) {$ scope.things = ['Item1', 'item2']; $ scope.clickOnInput = function () {// jQuery ('# searchBarArea'). ;};}) Directive ($ openMenuByClick ', function ($ timeout) {return {link} function (scope, element, ethers) {element.bind (' click ', function () {$ timeout (function () {$ ("#" +) Attrs.openMenuByClick) .Find ('Input'). ();}}}});}};});  

Add this button to your button

  & lt; Button ID = "BTN" open-menu-by-click = "searchbar area" & gt; Click me & lt; / Button & gt;  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -