I use this function to add some products code into a textarea with ng-click:
<textarea ng-model="rec.LOTTI">{{rec.lotti}}</textarea>
<div ng-repeat="reci in recis">
<div class="chip" ng-click="addTrack(reci.lotto)" style="float:left;margin:2px">
{{reci.prodotto}}
<i class="icon ion-plus-circled"></i>
</div>
</div>
$scope.addTrack = function(l){
$scope.rec.lotti = $scope.rec.lotti+", "+l;
console.log(l+$scope.rec.lotti);
}
The problem is that the ng-model value it's updated each time that I click, but inside the textarea I can't see anything!
It's not nessasry to have {{rec.lotti}}
inside your textarea, when you have a ng-model
(it's a two-way-binding). Another point is that rec.lotti
is not rec.LOTTI
; angular js is case-sensitive. Correct is:
<textarea ng-model="rec.lotti"></textarea>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.