lordfriend/nya-bootstrap-select

FIX: Need to double click on get focus in order to open the select list

Opened this issue · 1 comments

app.directive
(
'nyaFix',
[
'$timeout',
function ($timeout)
{
return function (scope, element, attrs)
{
var timeFromLostFocus = new Date();
$( "#" + element[0].id ).focusin
(
function()
{
$timeout
(
function()
{
var currectTime = new Date();
if( currectTime.getTime() - timeFromLostFocus.getTime() > 150)
$( "#" + element[0].id ).addClass('open');
},
100
);

					}
				);
				
				$( "#" + element[0].id ).focusout
				(
					function() 
					{
						timeFromLostFocus =  new Date();
					}
				);

				scope.$watch
				(
					attrs.ngModel,
					function()
					{
						$timeout
						(
							function()
							{
								$( "#"  + attrs.nyaFixSetFocusId ).focus();
							},
							250
						);		
					}	
				);
			};
		}
	]
);	

Use in the HTML

  1. {{option.displayName}}