I'm using ng-tags input, and the data I get after populating a line is an array of object, each with one 'text' string field like so
[{"text":"egon"},{"text":"peter"},{"text":"raymond"},{"text":"winston"}]
Is there a way to store the data as an array of strings instead? like
["egon", "peter", "raymond", "winston"]
ngTagsInput only works with arrays of objects. You can easily extract an array of strings out of an array of objects, though:
$scope.tagsString = $scope.tags.map(function(tag) { return tag.text; });
Update
It took some time, but ngTagsInput offers now basic support for array of strings. Starting in v3.2.0, the following is possible:
<tags-input ng-model="tags" use-strings="true"></tags-input>
Plunker
Better late than never, I guess.
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