Fill input dynamically with angle

0

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

    
asked by anonymous 24.03.2015 / 13:06

1 answer

1

I do not know if I understood correctly what you want. Is it just to display the tags, separated by ', ' , within an input?

It would look like this:

<input class="form-control" value="{{ project.tags.join(', ') }}">

Example.

    
24.03.2015 / 13:45