Je suis actuellement en train d'envoyer des messages au serveur via et API qui fonctionne correctement. Mais il y a des moments où je débranche intentionnellement l'Internet pour voir si mon pop fonctionnera mais il échoue.Fonction continuer à fonctionner même avec une connexion Internet IONIC2
register(){
this.loc_address=localStorage.getItem('user_location');
this.farmer_photo=localStorage.getItem('farmer_photo');
let loader = this.LoadingController.create({
content: 'Please Wait'
});
loader.present().then(()=>{
this.http.post("http://loclahost/app/farmer.php", {
'farmer_passcode':this.farmer_passcode,
'farmer_photo':this.farmer_photo}).map(res => res.json()) .subscribe(data => {
console.log(JSON.stringify(data[0].ID));
this.get_farmer_id=data[0].ID;
this.http.post("http://localhost/app/add.php", {
'farm_name': this.farm_name,
'farm_address':this.loc_address}).map(res => res.json()) .subscribe(data => {
console.log(JSON.stringify(data));
loader.dismiss();
let toast = this.toastcontroller.create({
message:'Farmer registration was successful',
duration:3000,
position:'bottom'
});
toast.present();
}),error=>{
loader.dismiss();
let alert = this.alertCtrl.create({
title: 'Error!',
subTitle: 'Please check your Internet Connectivity',
buttons: ['Try Again']
});
alert.present();
}
})
})
}
-t-il montre votre alerte d'erreur? –
non, il ne montre pas l'alerte – user6579134