Friends, help me make a script in which I can add words to an input, at the click of a button. The words should be side by side and separated by virgular:
word1, word2, word3
This gives me an input, as I add, with the filled-in value, but I do not want to generate multiple inputs but only one with words, as in the example above
<input type="text" ng-model="palavra">
<div ng-click="addpalavra(palavra);">+</div>
<div ng-show="palavra">
<span ng-repeat="palavra in project.palavras track by $index" ng-show="$index>0 || $parent.$index>0">{{ palavra }}
<input type="hidden" name="palavra[]" value ="{{palavra}}" ng-model="palavra" >
<script>
$scope.palavra = function(palavra) {
project.palavras.push(palavra);
};
</script>
THIS IS AN EXAMPLE, FROM THE ABOVE CODE: link