From bbb441a86837db02c6aafeacce00897683172694 Mon Sep 17 00:00:00 2001 From: Stephan Gabler Date: Tue, 8 Apr 2014 13:43:35 +0200 Subject: [PATCH] Create new Tag when element looses focus I used the tags directive in a form. When the user entered a new tag and directly clicked on the save/submit button without hitting enter or a separator (,) the entry did not get converted to a *tag*. The changes I propose add a new tag when the `tags` element looses focus --- src/tags.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tags.js b/src/tags.js index 2e89968..fa679a8 100644 --- a/src/tags.js +++ b/src/tags.js @@ -262,6 +262,15 @@ } }); }); + + /** + * complete tag on blur + */ + element.bind('blur', function (evt) { + scope.$apply(function () { + addTag(ngModel.$viewValue); + }); + }); /** * Inspects whatever you typed to see if there were character(s) of