简体   繁体   中英

angularJS textarea - textarea not showing text

I have this textarea

<textarea ng-model="textArea" ng-change="update(data.id,textArea)" style="height:120px; width:200px;">{{data.description}}</textarea>

when i run it the html code is:

<textarea ng-model="textArea" ng-change="update(data.id,textArea)" style="height:120px; width:200px;" class="ng-pristine ng-valid ng-binding">my test 123</textarea>

nothing strange except that i don't see the text on the textarea in the page..... some ideas??

That doesn't make sense. The current value of textarea comes from databinding ( ng-model ).

<textarea ng-model="textArea" ng-change="update(data.id,texArea)" 
       style="height:120px; width:200px;"></textarea>

in your controller, use $scope.textArea = 'YOURVALUE';

Alternatively you can set up "double binding" in controller, such as:

$scope.$watch('data.description', function(newValue){
  $scope.textArea = newValue;
});

ps, you have TYPO whe trying to spell " textArea ", you've spelt it as " texArea ".

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM