From 1458ba624a876a25ac0d8776388ecf4a16cc6aa7 Mon Sep 17 00:00:00 2001 From: Michael Benford Date: Sun, 23 Mar 2014 21:27:37 -0300 Subject: [PATCH] feat(tagsInput): Make maxLength consistent with minLength Make maxLength option behave like minLength option, i.e. instead of preventing lengthy tags from being typed it allows them but keep them from being added. Closes #53. --- src/tags-input.js | 1 + templates/tags-input.html | 1 - test/tags-input.spec.js | 65 +++++++++++++++++++++++++++++++-------- test/test-page.html | 4 +-- 4 files changed, 56 insertions(+), 15 deletions(-) diff --git a/src/tags-input.js b/src/tags-input.js index 89e53c55..1d9bee00 100644 --- a/src/tags-input.js +++ b/src/tags-input.js @@ -46,6 +46,7 @@ tagsInput.directive('tagsInput', function($timeout, $document, tagsInputConfig) var tagText = getTagText(tag); return tagText.length >= options.minLength && + tagText.length <= (options.maxLength || tagText.length) && options.allowedTagsPattern.test(tagText) && !findInObjectArray(self.items, tag, options.displayProperty); }; diff --git a/templates/tags-input.html b/templates/tags-input.html index 73519e74..78d39261 100644 --- a/templates/tags-input.html +++ b/templates/tags-input.html @@ -9,7 +9,6 @@ - - +