[英]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.