简体   繁体   English

angularJS textarea-textarea不显示文本

[英]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: 当我运行它的HTML代码是:

<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?? 没什么奇怪的,除了我没有在页面的textarea上看到文本。

That doesn't make sense. 那没有道理。 The current value of textarea comes from databinding ( ng-model ). textarea的当前值来自数据绑定( 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'; 在您的控制器中,使用$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 ". ps,您有TYPO试图拼写“ textArea ”,您将其拼写为“ texArea ”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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