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

prevent ng-tags-input from removing tag on backspace #886

Open
wholeinsoul opened this issue Jan 19, 2020 · 1 comment
Open

prevent ng-tags-input from removing tag on backspace #886

wholeinsoul opened this issue Jan 19, 2020 · 1 comment

Comments

@wholeinsoul
Copy link

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.

@gauravdixit007
Copy link

@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;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants