Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Commit

Permalink
Fixes "-1" of undefined error produced when losing focus.
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarvaja committed Oct 19, 2016
1 parent 46f609b commit a467d2c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tags-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ tagsInput.directive('tagsInput', function($timeout, $document, $window, $q, tags
addKeys = {},
shouldAdd, shouldRemove, shouldSelect, shouldEditLastTag,
newTagText = scope.newTag.text();
if ((event.keyCode === 229) && (scope.text[newTagText.length -1] === ',')) {
if ((event.keyCode === 229) && (scope.text !== undefined) && (scope.text[newTagText.length -1] === ',')) {
key = KEYS.comma;
newTagText = newTagText.slice(0, -1); // Remove comma
}
Expand Down

0 comments on commit a467d2c

Please sign in to comment.