Ionic 2 toast can't be dismissed manually -


i working on ionic2 project , trying show connection status message in app. here code:

import { toastcontroller, toast  } 'ionic-angular'; connectedtoast: toast; disconnectedtoast: toast;  this.connectedtoast = this.toast.create({         message: `you ${networkstatus.connecttype} via ${networkstatus.networktype}`,         position: 'bottom',         cssclass: 'toast-connected',         duration: 3000     });      this.disconnectedtoast = this.toast.create({         message: `this function not available because ${networkstatus.connecttype}`,         position: 'bottom',         cssclass: 'toast-disconnected'     });      if(networkstatus.isonline) {                       if(this.disconnectedtoast != null)                              this.disconnectedtoast.dismiss();          this.connectedtoast.present();     }      if(networkstatus.isoffline) this.disconnectedtoast.present(); 

what wanted achieve is: if offline, toast msg stay there until online. online message, display 3 seconds. working fine except when online , after online message displayed, offline toast msg stays there , didn't disappear though called dismiss(). did miss here?

my environment is: "ionic-angular": "3.3.0", "ionic": "3.6.0", "typescript": "2.3.3"

any appreciated!


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -