Suresh PMS Suresh PMS - 2 years ago 91
Javascript Question

angular - passing ngmodel bound to an element to a function bound to another element

I have a requirement of passing a value entered in an

element to a function
which is bound to another element. So, whenever the value in the input field changes, the calculated values should reflect in the

If it could be done in any other way, please let me know. Appreciated.

My Html goes as follows:

<td ng-repeat="score in player.scores ">
<input type="text" ng-value="{{score.stroke}}" ng-model="???????"/>
<td ng-repeat="param in cellParams >{{calculate(??????)}}</td>

Answer Source

I have achieved this using $watch().

$scope.$watch('player', function(newVal, oldVal) { 

Got this answer from Alpesh's hint.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download