there is my code.
onChangehomeloaninterest(ev: any) {
// alert(this.homeloaninterest);
this.monthlyinstrest=12/this.homeloaninterest/100;// calculate the monthly instrest 0.012
//alert(this.monthlyinstrest);
}
onChangehomeloanloantenure(ev: any) {
this.month= this.homeloanloantenure*12;// here convert year to month
let payments=Math.pow(1+this.monthlyinstrest,this.month);
this.finalammount=(this.homeloanamount*payments*this.monthlyinstrest)/(payments-1);
alert(this.finalammount)
When i put the value
principal=100000
rateofinstrest=10%
time=1;
showing this EMI amount=>8997.54332793509 but it is wrong.
its correct 8791.59
please help me anyone.
ok i will try. @reedrichards
@reedrichards
Is not working

sorry to hear that, hope someone will have a better idea
actually when i’m punting the data above 600000 its working fine but is not working for 100000.but why i can’t understand
Hello,
please show how you declare all used variables and all calculation steps.
Maybe anywhere is a string and not a number.
Best regards, anna-liebt.
My ts
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-emi-cal',
templateUrl: 'emi-cal.html',
})
export class EmiCalPage {
homeloanamount: number = 5000;
homeloaninterest: number = 15;
homeloanloantenure: number =5;
rateofinstrest:number;
monthlyinstrest:number;
month:number;
finalammount:number;
instertammout:number;
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad EmiCalPage');
}
onChangehomeloanamount(ev: any) {
//alert(this.homeloanamount);
}
onChangehomeloaninterest(ev: any) {
this.monthlyinstrest=12/this.homeloaninterest/100;// calculate the monthly instrest 0.012
}
onChangehomeloanloantenure(ev: any) {
this.month= (this.homeloanloantenure*12);// here year convert to month 36
let payments=Math.pow(1+this.monthlyinstrest,this.month);
this.finalammount=(this.homeloanamount*payments*this.monthlyinstrest)/(payments-1);
alert(this.finalammount)
}
}
HTML
<ion-item>
<ion-label color="primary">Home Loan Amount</ion-label>
<ion-input placeholder="Text Input" [(ngModel)]="homeloanamount"></ion-input>
<ion-icon item-right><i class="fa fa-inr" aria-hidden="true"></i></ion-icon>
</ion-item>
<ion-list>
<ion-item>
<ion-range [(ngModel)]="homeloanamount" max="20000000" (ionChange)="onChangehomeloanamount($event)">
<!--<ion-icon range-left small name="sunny"></ion-icon>
<ion-icon range-right name="sunny"></ion-icon>-->
</ion-range>
</ion-item>
</ion-list>
<ion-item>
<ion-label color="primary">Interest Rate</ion-label>
<ion-input placeholder="Text Input" [(ngModel)]="homeloaninterest"></ion-input>
<ion-icon item-right><i class="fa fa-percent" aria-hidden="true"></i></ion-icon>
</ion-item>
<ion-list>
<ion-item>
<ion-range [(ngModel)]="homeloaninterest" max="20" (ionChange)="onChangehomeloaninterest($event)">
<!--<ion-icon range-left small name="sunny"></ion-icon>
<ion-icon range-right name="sunny"></ion-icon>-->
</ion-range>
</ion-item>
</ion-list>
<ion-item>
<ion-label color="primary">Loan Tenure</ion-label>
<ion-input placeholder="Text Input" [(ngModel)]="homeloanloantenure" ></ion-input>
<ion-icon item-right><i class="fa fa-percent" aria-hidden="true"></i></ion-icon>
</ion-item>
<ion-list>
<ion-item>
<ion-range [(ngModel)]="homeloanloantenure" max="30" (ionChange)="onChangehomeloanloantenure($event)">
<!--<ion-icon range-left small name="sunny"></ion-icon>
<ion-icon range-right name="sunny"></ion-icon>-->
</ion-range>
</ion-item>
</ion-list>
Please check.
Hello,
please check if text from input is converted correct to number you expect.
Best regards, anna-liebt
@anna_liebt you are right, just test op’s code locally
when sliding a radio -> value gonna be a number/float
when entering a value in one a the input -> value gonna be a string
there is most probably your problem @flycoders_sourav
Thank your for your valuable reply.I have fixed my problem
i’m just add this line type=“number” into the ion-input
thanks again @anna_liebt and @reedrichards for your positive response