For my Ionic 2 application I call a plugin. After its success callback I update the view (which works), and then I call another method of the same plugin. After that I also want to update the view, but that doesn’t work. Some code:
(<any>window).MyPlugin.firstMethod((result) => {
this.visible = true; /* Updating view, works */
(<any>window).MyPlugin.secondMethod((result) => {
this.visible = false; /* Updating view, doesn't work! */
});
});
The view only updates after I fire a completely other method (example when I press a button somewhere else on the template). So, the this.visible
gets updated after the second method call, but the update is not visible in the view.
Does anyone has an idea? Thanks!
EDIT: Okay… solved after wrapping it in a NgZone