I am quite new to AngularJS, I want a html file that can dynamically calculate the sum as when I update my variables (say a & b) using AngularJS. Here is my code snippet
HTML: Code Snippet for HTML
Javascript: Code Snippet for Javascript
On updating my input values, the sum still comes on to be 0, and does not get updated. Sorry for the mediocrity of the question, but pls suggest a solution.
Set a function to sum input value
Controller
$scope.a = 0; $scope.b = 0;
$scope.sum = function(a, b) {
return a + b;
}
Html
<input type="number" ng-model="a" />
<input type="number" ng-model="b" />
<div>
{{sum(a,b)}}
</div>
Working fiddle