I am selecting two checkboxes and the amount is getting calculated in Total Claimed in the 1st div but 2 nd div also the amount is getting calculated. The reason I know; Its coz the div is created using array and I have one common variable. Now the issue arises how to create a dynamic variable ?
In below code, you will find {{claimed}} which is the common variable and I need this to be dynamic:
<p>Total Claimed: [<span [ngClass]="{'text-success': claimed <= d.program_max_limit, 'text-warning': claimed > d.program_max_limit}">{{claimed | number : '2.'}} </span> Of {{d.program_max_limit | number : '2.'}}]</p>
component.ts This is the function of the calculation portion:
calc(event,val, id) {
console.log(val,id)
var i=0;
if(id == event.target.value){
if(event.target.checked ){
this.claimed = parseInt(this.claimed) + parseInt(val);
if (this.claimed > this.max_amount) {
this.push.showError("You Have Reached the Maximum Limit");
this.isDisabled = true;
this.checkForm.reset();
this.claimed = 0;
} else {
this.isDisabled = false;
}
} else {
this.claimed = parseInt(this.claimed) - parseInt(val);
}
}
