我正在开发书中的示例应用程序AngularJS。
在下面的代码中,{{funding.needed}}
不显示为10 * startingEstimate
. 它按字面意思显示,即不呈现,就像{{funding.needed}}
在页面上一样。
为什么?
<html ng-app>
<body ng-controller="TextController">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js">
</script>
<form ng-controller="StartUpController">
Starting: <input ng-change="computeNeeded()"
ng-model="funding.startingEstimate">
Recommendation: {{funding.needed}}
</form>
<script>
function StartUpController($scope) {
$scope.funding = { startingEstimate: 0};
$scope.computeNeeded = function() {
$scope.needed = $scope.startingEstimate * 10;
};
}
</script>
</body>
</html>