Reputation: 605
When adding a space-separated tag, ng-tags-input will replace the space with a dash. How can I keep the space character instead?
Upvotes: 5
Views: 2483
Reputation: 163
In order to replace spaces with underscores, I did the following:
HTML:
<tags-input ng-model="model" replace-spaces-with-dashes="false" on-tag-adding="addingTag($tag)"></tags-input>
JS:
$scope.addingTag = function(tag) {
tag.text = tag.text.replace(/ /g, '_');
return tag;
};
Upvotes: 3
Reputation: 605
I've just found the corresponding directive property on the documentation.
Answer: use replace-spaces-with-dashes=false
Upvotes: 8