I have a button on my html page, on clicking this button data is saved in the database. Sometimes, the same record is saved twice in the database, unable to debug the reason.
My code:
home.html
<button ion-button class="orng_btn" (click)="has_pass()" [disabled]="disabled_kot == true?true:false">Save</button>
home.ts
has_pass()
{
this.disabled_kot = true;
// calling webservice
this.user.k_kot(encodeURIComponent(JSON.stringify(this.f_arr))).subscribe(data=>{
console.log(data,"data");
this.navCtrl.setRoot('HomePage');
});
}
Note that on pressing the button we are using setRoot
to refresh the page, is it that this sometimes may be creating 2 instances of this page? Or there is something else we need to do?