I tried and could be achieved using the directory method. violin
angular .module('myApp', [ 'ngSanitize', 'ui.select' ]) .controller('testController', function ($scope) { $scope.things = ['item1', 'item2']; $scope.clickOnInput = function() { //jQuery('#searchBarArea').click(); }; }) .directive('openMenuByClick', function ($timeout) { return { link: function (scope, element, attrs) { element.bind('click', function () { $timeout(function () { $("#"+attrs.openMenuByClick).find('input').click(); }); }); } }; });
Add this attribute directive to your button
<button id="btn" open-menu-by-click="searchBarArea">Click me</button>
source share