Merge "Add timeout to the blur event of tag-complete"

This commit is contained in:
Jenkins 2014-11-24 13:02:32 +00:00 committed by Gerrit Code Review
commit 14b1f76b50

View File

@ -19,7 +19,7 @@
* set of source data, and restricts inputs to items in that list.
*/
angular.module('sb.util').directive('tagComplete',
function ($q, $parse, $rootScope, $position, typeaheadParser) {
function ($q, $parse, $rootScope, $position, typeaheadParser, $timeout) {
'use strict';
var HOT_KEYS = [9, 13, 27, 38, 40];
@ -165,12 +165,14 @@ angular.module('sb.util').directive('tagComplete',
* Blur when the input gets blurred.
*/
$input.on('blur', function () {
resetMatches();
$scope.newTagName = '';
$scope.hasFocus = false;
if (!$rootScope.$$phase) {
$scope.$digest();
}
$timeout(function() {
resetMatches();
$scope.newTagName = '';
$scope.hasFocus = false;
if (!$rootScope.$$phase) {
$scope.$digest();
}
}, 200);
});
/**