I'm developing Hybrid app using Ionic-3
. I'm trying to call function from Html
and get some values return from typescript
with this function but i see the function is call multiple times and my browser and application is hang. My html and typescript function is below.
HTML
<div *ngFor="let product of myCourier">
<ion-row>
<ion-col col-6> Charge</ion-col>
<ion-col col-6>Rs. {{getcharge(product)}}</ion-col>
</ion-row>
</div>
Typescript
getcharge(item){
var dat: { [k: string]: any } = {};
dat.toaddress = item.to_address
dat.fromaddress = item.from_address
this.httpClient.post(this.config.url + 'getrate.php', dat).subscribe((data: any) => {
if (data.ResponseCode == 1) {
var charge = data.charge
console.log(charge)
return charge
}
});
}