mbenford / ngTagsInput

Tags input directive for AngularJS

Home Page:http://mbenford.github.io/ngTagsInput

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prevent ng-tags-input from removing tag on backspace

wholeinsoul opened this issue · comments

commented

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