javascript - angularJS get value from a textarea inside a ng-repeat -


How do I get inside a textarea within a ng-repeat

  & lt; Div class = "container" ng-repeat = "data data list in data | filter: {sea: season}" & gt; & Lt; Img src = "..//content/catalog/ {{session}} / {{data.id}}" /> & Lt; Div class = "container description" & gt; Desc: & lt; P & gt; & Lt; Textarea ng-model = "textarie [$ index]" style = "height: 120px; width: 200px;" & Gt; {{Data decimation}} & lt; / Textarea & gt; & Lt; / P & gt; & Lt; Div ng-click = "savings (data. Id, $ index)" & gt; Save & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

..

  $ scope.saveDescription = function (id, count) {description = $ scope.textArea [count] Alert (description)} < / Code> 

What's my mistake?

  & lt; Div class = "container" ng-repeat = "data in data list data | filter: {sea: seasons}" & gt; & Lt; Img src = "..//content/catalog/ {{session}} / {{data.id}}" /> & Lt; Div class = "container description" & gt; Desc: & lt; P & gt; & Lt; Textarea ng-model = "textArea" style = "height: 120px; width: 200px;" & Gt; {{Data.description}} & lt; / Textarea & gt; & Lt; / P & gt; & Lt; Div ng-click = "savings (data. Id, $ index, textaria)" & gt; Save & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

No need to use an array just pass the text to the function as the parameter

  $ scope.saveDescription = function (id, count , TextArea) {description = textArea; Warning (description)}  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -