<html ng-app> <body> <form ng-controller="startupcontroller"> starting: <input ng-change="computeneeded()" ng-model="funding.startingestimate"> recommendation: {{funding.needed}} </form> <script src="angular.min.js"></script> <script> function startupcontroller($scope) { $scope.funding = { startingestimate: 0 }; $scope.computeneeded = function () { $scope.needed = $scope.startingestimate * 10; }; } </script> </body> </html> 
the output ten times value entered in textbox... not receiving output.
the startingestimate not in scope. it's in funding, in scope.
and template looks needed in funding, , not in scope.
so code should be:
$scope.funding.needed = $scope.funding.startingestimate * 10;
Comments
Post a Comment