Reputation: 3663
Here is my Plnkr: https://plnkr.co/edit/69gkIzHUnIl7r6kpvo6L
When I type data in the textarea
and click "Add," the added textarea
has data I typed in the first one.
I do not want this. I want the added textarea
to be blank, but I also want it to be part of ngModel "customize." I want it to be a new instance of $scope.customize
, just as the first textarea
is.
How do I accomplish this?
Upvotes: 0
Views: 57
Reputation: 15407
The problem is you're using the same ng-model
for all textareas
, all you need to do is to use a different ng-model
value for each one , and then you can read the content of that textarea
in your controller
using the ng-model
you set.
Refer to this updated version of your code.
Upvotes: 2
Reputation: 978
Here is a working plunker example https://plnkr.co/edit/TSGT04nCV3NK16nsl1e6?p=preview Now we have item in items which binded to each new textarea
Just make a little change to textarea
<textarea rows="5" cols="50" placeholder="Paste data here." ng-model="item.hed"></textarea>
Upvotes: 1