01.
<!DOCTYPE html>
02.
<html>
04.
<body>
05.
06.
<div ng-app=
"myApp"
ng-controller=
"myCtrl"
>
07.
08.
<div class=
"form-group"
>
09.
<label
for
=
""
>จำนวนเงินรวม</label>
10.
<input type=
"number"
class=
"form-control"
name=
"amount"
ng-model=
"Add"
required=
"required"
>
11.
</div>
12.
13.
<p>{{SumTotal() + Add}}</p>
14.
</div>
15.
16.
<script>
17.
var
app = angular.module(
'myApp'
, []);
18.
app.controller(
'myCtrl'
,
function
($scope) {
19.
20.
$scope.item_1 = 1;
21.
$scope.item_2 = 2;
22.
$scope.item_3 = 3;
23.
$scope.item_4 = 4;
24.
$scope.item_5 = 5;
25.
$scope.item_6 = 6;
26.
27.
$scope.SumTotal =
function
() {
28.
return
$scope.item_1 + $scope.item_2 + $scope.item_3 + $scope.item_4 + $scope.item_5 + $scope.item_6;
29.
};
30.
31.
});
32.
</script>
33.
34.
</body>
35.
</html>