run overlay animations outside zone

This commit is contained in:
Adam Bradley
2015-08-28 16:38:39 -05:00
parent 067179d1cc
commit d94ceaf948
2 changed files with 24 additions and 5 deletions

View File

@ -83,6 +83,14 @@ export class IonicApp {
this._zone.run(fn);
}
/**
* TODO
* @param {Function} fn TODO
*/
zoneRunOutside(fn) {
this._zone.runOutsideAngular(fn);
}
/**
* Register a known component with a key, for easy lookups later.
* @param {TODO} key The key to use to register the component

View File

@ -75,6 +75,8 @@ export class Overlay {
export class OverlayRef {
constructor(app, overlayType, opts, ref, context) {
this.app = app;
let overlayInstance = (ref && ref.instance);
if (!overlayInstance) return;
@ -127,12 +129,21 @@ export class OverlayRef {
ClickBlock(true, animation.duration() + 200);
animation.play().then(() => {
ClickBlock(false);
animation.dispose();
instance.viewDidEnter && instance.viewDidEnter();
resolve();
this.app.zoneRunOutside(() => {
animation.play().then(() => {
this.app.zoneRun(() => {
ClickBlock(false);
animation.dispose();
instance.viewDidEnter && instance.viewDidEnter();
resolve();
});
});
});
}).catch(err => {
console.error(err);
});