When adding a space-separated tag, ng-tags-input will replace the space with a dash. How can I keep the space character instead?
I've just found the corresponding directive property on the documentation.
Answer: use replace-spaces-with-dashes=false
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;
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With