change event is not working for me
please could any body help me
after clicking of qty and rate it can display total value
here i put a ng-keyup event
if we enter any values on qty and rate it can automatically display the total value
Please refer code and help me
var invoice = angular.module('invoice', []);
invoice.controller('InvoiceController', function ($scope) {
$scope.invoice = {
items: [{
name: 'item',
description: 'item description',
qty: 5,
price: 5.5
}]
};
$scope.add = function () {
$scope.invoice.items.push({
name: '',
description: '',
qty: 1,
price: 0
});
},
$scope.remove = function (index) {
$scope.invoice.items.splice(index, 1);
},
$scope.total = function () {
var total = 0;
angular.forEach($scope.invoice.items, function (item) {
total += item.qty * item.price;
})
return total;
}
$scope.AddNumbers = function () {
var a = Number($scope.item.qty || 0);
var b = Number($scope.item.price || 0);
$scope.Total = a * b;
}
});
| Name | Description | Qty | Price | Total | Delete |
|---|---|---|---|---|---|
| {{item.Total}}€ | |||||
| Total : | {{total()}} € |
Mahesh ReddyPosted Nov 29, 2018, 9:27 AM
Piyush PansuriyaPosted Nov 29, 2018, 8:09 AM
Mahesh ReddyPosted Nov 29, 2018, 8:05 AM
Piyush PansuriyaPosted Nov 29, 2018, 7:54 AM