Below I have 5 input field which are rent , cam , security and support and estimated revenue , now how do we bind those input fields to get each value and show and assign the total of the 5 fields to the total rent field ?
Everytime the value changes on for example on rent , cam etc. it should update the total value on the total montly rent field
For example if rent field value is 2 , cam is 1 , security is 1 , support is 1 and estimated revenue is 1 then the value of total monthly rent is 6. And If I change any of the value it should update the total.
Anyone has an idea , would be muchly appreciated.
#ts code
class DealPLSFormFields {
dealName:string;
dealSummary:string;
dealPartner:string;
startDate: string;
endDate: string;
rent: number;
cam:number;
totalBrokerCommission: number;
supportServicesFee: number;
estimatedOtherRevenue;
descriptionOfOtherRevenue: string;
totalMonthlyRentAndFees : number;
buildOutCostReimbursement: number;
dealId: number;
securityMonitoring: any;
constructor(){
this.dealName = null;
this.dealSummary = null;
}
}
dealPLSFormFields: DealPLSFormFields;
ngOnInit(): void {
this.dealPLSFormFields = new DealPLSFormFields();
}
#html code
<div fxLayout="row" fxLayoutAlign="space-between center" >
<mat-form-field appearance="fill" class="w-49per">
<mat-label>Rent (Monthly)</mat-label>
<input
matInput
[(ngModel)]="dealPLSFormFields.rent"
[required]="isExistingDeal">
</mat-form-field>
<mat-form-field appearance="fill" class="w-49per">
<mat-label>CAM (Monthly)</mat-label>
<input
matInput
[(ngModel)]="dealPLSFormFields.cam"
[required]="isExistingDeal">
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-between center" >
<mat-form-field appearance="fill" class="w-49per">
<mat-label>Security Monitoring (Monthly)</mat-label>
<input
matInput
[(ngModel)]="dealPLSFormFields.securityMonitoring"
[required]="isExistingDeal">
</mat-form-field>
<mat-form-field appearance="fill" class="w-49per">
<mat-label>Support Services Fee (Monthly)</mat-label>
<input
matInput
[(ngModel)]="dealPLSFormFields.supportServicesFee"
[required]="isExistingDeal">
</mat-form-field>
</div>
<mat-form-field appearance="fill">
<mat-label>Estimated Other Revenue (e.g, percentage rent, referral fees)</mat-label>
<input
matInput
[(ngModel)]="dealPLSFormFields.estimatedOtherRevenue"
[required]="isExistingDeal">
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>Description of Other Revenue</mat-label>
<input
matInput
[(ngModel)]="dealPLSFormFields.descriptionOfOtherRevenue"
[required]="isExistingDeal">
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>Total Monthly Rent and Fees</mat-label>
<input
matInput
[(ngModel)]="dealPLSFormFields.totalMonthlyRentAndFees"
[required]="isExistingDeal">
</mat-form-field>
