ngTagsInput icon indicating copy to clipboard operation
ngTagsInput copied to clipboard

prevent ng-tags-input from removing tag on backspace

Open wholeinsoul opened this issue 5 years ago • 1 comments

Is there a way to prevent ng-tags-input from removing the tags by using backspace in the input box. There is a on-tag-removing callback but that does not have $event to detect if it the tag is being removed using the backspace or 'x' button.

Thanks.

wholeinsoul avatar Jan 19 '20 19:01 wholeinsoul

@wholeinsoul You might have already solved this. Just in case somebody else comes here with same requirement. You can achieve this by deleting segments in bold from the lines:

Line 464: shouldRemove = (key === KEYS.backspace || key === KEYS.delete) && tagList.selected;

Line 466: (key === KEYS.backspace || key === KEYS.left || key === KEYS.right) && scope.newTag.text().length === 0 && !options.enableEditingLastTag;

gauravdixit007 avatar May 28 '20 13:05 gauravdixit007