[英]angularJS textarea - textarea not showing text
我有这个文本区域
<textarea ng-model="textArea" ng-change="update(data.id,textArea)" style="height:120px; width:200px;">{{data.description}}</textarea>
当我运行它的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>
没什么奇怪的,除了我没有在页面的textarea上看到文本。
那没有道理。 textarea的当前值来自数据绑定( ng-model )。
<textarea ng-model="textArea" ng-change="update(data.id,texArea)"
style="height:120px; width:200px;"></textarea>
在您的控制器中,使用$scope.textArea = 'YOURVALUE';
另外,您可以在控制器中设置“双重绑定”,例如:
$scope.$watch('data.description', function(newValue){
$scope.textArea = newValue;
});
ps,您有TYPO试图拼写“ textArea ”,您将其拼写为“ texArea ”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.