Created
July 3, 2015 06:58
-
-
Save jbmyid/2ddd736f806470e62694 to your computer and use it in GitHub Desktop.
Revisions
-
jbmyid created this gist
Jul 3, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ .directive('typeaheadClickOpen', function($parse, $timeout) { var dir; return dir = { restrict: 'A', require: 'ngModel', link: function($scope, elem, attrs) { var triggerFunc; triggerFunc = function(evt) { var ctrl, prev; ctrl = elem.controller('ngModel'); prev = ctrl.$modelValue || ''; ctrl.$setViewValue(prev ? '' : ' '); if (prev) { return $timeout(function() { return ctrl.$setViewValue("" + prev); }); } }; return elem.bind('click', triggerFunc); } }; });