You could have a function that is called when ng-change on each of the inputs happens. You should avoid having logic/arithmetic in the view..
Then you can have this function in the controller of the page or element and call it like
<input type="text" ng-change="ctrl.myFunc(value1,value2)"/>
for both inputs.
Edit: By the way there is no ng-model for p tag!! you need to make that a readonly input instead if you want to use it for other subsequent value caluclation. http://docs.angularjs.org/api/ng/directive/ngModel
Edit 2: Alternatively you can use value="{{value1 + ... }}"
in your inputs like (given your example):
<input type="text" ng-model="A" value="0"/>
<input type="text" ng-model="B" value="{{A + 2}}"/>
<input type="text" ng-model="C" value="{{B + 1}}"/>
Edit 3:
Here is the full solution: (also in plunkr to see it in action: http://plnkr.co/edit/FXAae6mjOGOfw2Xczlb1)
Keep in mind that having everything in $scope is a bad practice for bigger applications and also <br/>
's shouldn't be used. This is an example just for illustration purposes :)
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0-beta.5/angular.min.js"></script>
</head>
<body ng-app="bindExample">
<script>
angular.module('bindExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.calculate = function() {
if (!$scope.noninput) $scope.noninput = [];
if (!$scope.value) $scope.value = [];
$scope.noninput[0] = parseInt($scope.value[0]) + parseInt($scope.value[1]) || 0;
$scope.value[2] = $scope.noninput[0]+100;
};
}]);
</script>
<div ng-controller="ExampleController">
1st Value plus: <input type="text" ng-model="value[0]" value="{{value[0]}}" ng-change="calculate()"/><br/>
2nd Value: <input type="text" ng-model="value[1]" value="{{value[1]}}" ng-change="calculate()"/><br/>
Non input result: <span ng-bind="noninput[0]">{{noninput[0]}}</span><br/>
Value 3nd (non-input result plus 100): <input type="text" ng-model="value[2]" value="{{value[2]}}"/><br/>
<br/>
Model:<br/>
(Input Values): {{value}}<br/>
(Non Input Values): {{noninput}}<br/>
</div>
</body>
</html>
`s, with the next one being dependent on the prior value. Would `ng-change` allow me to have say a value4 = value3 + value (heavily simplified), value5 = value4 + value1, etc?
– MeanDean73 Feb 25 '15 at 16:32