I want to do cascade operations in textboxes with Angular. Assume I have 4 numbers in existing textboxes, I want to:
- Sum first two numbers in first textbox
- Sum next two numbers in second textbox
- Sum both results in third textbox
This is HTML example of what I want to do. I know it's not working, but I'm searching for most elegant solution of my problem.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>AngularTest</title>
</head>
<body ng-app>
<form>
<fieldset>
<label for="first">Tag100</label>
<input type="number" id="first" min="0" ng-model="tag100" placeholder="0" /><br/>
<label for="second">Tag200</label>
<input type="number" id="second" min="0" ng-model="tag200" placeholder="0" /><br/>
<label for="third">Tag300</label>
<input type="number" id="third" min="0" ng-model="tag300" placeholder="0" /><br/>
<label for="fourth">Tag400</label>
<input type="number" id="fourth" min="0" ng-model="tag400" placeholder="0" /><br/>
<label for="onetwo">Tag 500 = Tag100 + Tag200</label>
<input type="number" id="onetwo" min="0" ng-model="tag500" placeholder="0" value="{{tag100+tag200}}"/><br/>
<label for="threefour">Tag 600 = Tag300 + Tag400</label>
<input type="number" id="threefour" min="0" ng-model="tag600" placeholder="0" value="{{tag300+tag400}}"/><br/>
<label for="fivesix">Tag 700 = Tag500 + Tag600</label>
<input type="number" id="fivesix" min="0" ng-model="tag700" placeholder="0" value="{{tag500+tag600}}" /><br/>
</fieldset>
</form>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
</body>
</html>