0

I have two fields in my form as shown bellow

Total amount: <input type="text" value="1230"></input>
<br>
<textarea>amount in words goes here..</textarea>  

Now, I need to display the value amount of my first input field to textarea as one thousand two hundred thirty.

Thanks

Jai Reddy
  • 13
  • 4

2 Answers2

0

There is no role of Angular in this. Its simple logic that you have to use. This Question is answered here for javascript.

UPDATE: This is another solution I found for your problem.

Community
  • 1
  • 1
Ayush Gupta
  • 1,589
  • 3
  • 13
  • 23
0

To get you started: Use ng-model to bind to model data and ng-change to react on any change in your input:

Total amount: <input type="text" ng-model="data.text" ng-change="countWords()" value="1230"></input>

in your controller:

$scope.data = {text:"", count:0};
$scope.countWords = function(){
  $scope.data.count = [count the words of $scope.data.text...]
};

then display the value in your view:

<textarea>{{data.count}}</textarea> 
Andre Kreienbring
  • 2,457
  • 11
  • 16