我正在使用一个小型计算器,我几乎想出了如何输入一个数字并获得一行的总和但由于某种原因我无法得到我的High Impact行和Low Impact行的总和出现。这是我的HTML
<table>
<thead>
<tr>
<th>Move Types</th>
<th>Avg. $ Cost per Lost Day</th>
<th>Avg. Lost Productivity (# Days)</th>
<th>Volume of Moves</th>
<th>Annual Lost Productivity Cost</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>High Impacts</strong></td>
<td data-label="Avg. $ Cost per Lost Day">$
<input type="number" class=" input input-sm" style="width:150px" type="text" ng-model="highLost">
</td>
<td data-label="Avg. Lost Productivity (# Days)">24.4</td>
<td data-label="Volume of Moves">
<input type="number" class=" input input-sm" style="width:150px" type="text" ng-model="highVolMove">
</td>
<td data-label="Annual Lost Productivity Cost">
$<span ng-bind="sumHight() | number:0" style="font-weight:bold;"></span>
</td>
</tr>
<!-- Low Impacts -->
<tr>
<td><strong>Low Impacts</strong></td>
<td data-label="Avg. $ Cost per Lost Day">
$
<input type="number" class=" input input-sm" style="width:150px" type="text" ng-model="lowLost">
</td>
<td data-label="Avg. Lost Productivity (# Days)">
14.8
</td>
<td data-label="Volume of Moves">
<input type="number" class=" input input-sm" style="width:150px" type="text" ng-model="lowVolMove">
</td>
<td data-label="Annual Lost Productivity Cost">
$ <span ng-bind="sumLow() | number:0" style="font-weight:bold;"></span>
</td>
</tr>
<!-- end Low Impact -->
<tr>
<td data-label="All Moves"><strong>All Moves</strong></td>
<td data-label="Avg. $ Cost per Lost Day">
$ <span ng-bind="allMoves() | number:0" style="font-weight:bold;"></span>
</td>
<td data-label="Avg. Lost Productivity (# Days)">
39.2
</td>
<td data-label="Volume of Moves">
<span ng-bind="volumeOfMoves() | number:0" style="font-weight:bold;"></span>
</td>
<td data-label="Annual Lost Productivity Cost">
$ <span ng-bind="annualLostProductivity() | number:0" style="font-weight:bold;"></span>
</td>
</tr>
</tbody>
</table>
这是我的控制器
angular.module('cal', [])
.controller('homeController', ['$scope', function($scope) {
$scope.sumHight = function() {
return $scope.highLost * 24.4 * $scope.highVolMove;
}
$scope.sumLow = function() {
return $scope.lowLost * 14.8 * $scope.lowVolMove;
}
$scope.allMoves = function() {
return $scope.highLost + $scope.lowLost;
}
$scope.volumeOfMoves = function() {
return $scope.highVolMove + $scope.lowVolMove;
}
$scope.annualLostProductivity = function() {
return $scope.sumHight + $scope.sumLow;
}
}]);
我能够复制其他结果,但是当我使用时,它们有效:
$scope.annualLostProductivity = function() {
return $scope.sumHight + $scope.sumLow;
}
我一无所获。
如果您能够提供帮助,请提前致谢。
罗布
答案 0 :(得分:2)
您需要调用这些功能 - 您需要添加&#34;添加&#34;改为引用函数声明。
DatabaseController
答案 1 :(得分:0)
请记住在调用函数时使用()
! :d