總額在數量上我有我的形式兩個領域如波紋管單詞轉換
Total amount: <input type="text" value="1230"></input>
<br>
<textarea>amount in words goes here..</textarea>
現在,我需要爲1230,以顯示我的第一個輸入字段的值量的textarea。
謝謝
總額在數量上我有我的形式兩個領域如波紋管單詞轉換
Total amount: <input type="text" value="1230"></input>
<br>
<textarea>amount in words goes here..</textarea>
現在,我需要爲1230,以顯示我的第一個輸入字段的值量的textarea。
謝謝
爲了讓你開始: 使用NG-模型綁定到數據和NG-變化模型,以對您輸入的任何變化做出反應:
Total amount: <input type="text" ng-model="data.text" ng-change="countWords()" value="1230"></input>
在你的控制器
:
$scope.data = {text:"", count:0};
$scope.countWords = function(){
$scope.data.count = [count the words of $scope.data.text...]
};
然後在您的視圖中顯示該值:
<textarea>{{data.count}}</textarea>
請熟悉angularjs的基本概念。 –
刪除這個問題,它對你很好。 – katmanco