diff --git a/ionic/components/menu/menu.ts b/ionic/components/menu/menu.ts index 0ed307c5ba..fe8837708a 100644 --- a/ionic/components/menu/menu.ts +++ b/ionic/components/menu/menu.ts @@ -1,4 +1,4 @@ -import {Component, forwardRef, Directive, Host, EventEmitter, ElementRef} from 'angular2/core'; +import {Component, forwardRef, Directive, Host, EventEmitter, ElementRef, NgZone} from 'angular2/core'; import {Ion} from '../ion'; import {IonicApp} from '../app/app'; @@ -113,16 +113,14 @@ import * as gestures from './menu-gestures'; export class Menu extends Ion { constructor( - app: IonicApp, elementRef: ElementRef, config: Config, - platform: Platform, - keyboard: Keyboard + private app: IonicApp, + private platform: Platform, + private keyboard: Keyboard, + private zone: NgZone ) { super(elementRef, config); - this.app = app; - this.platform = platform; - this.keyboard = keyboard; this.opening = new EventEmitter('opening'); this.isOpen = false; @@ -177,16 +175,18 @@ export class Menu extends Ion { * @private */ _initGesture() { - switch(this.side) { - case 'right': - this._gesture = new gestures.RightMenuGesture(this); - break; + this.zone.runOutsideAngular(() => { + switch(this.side) { + case 'right': + this._gesture = new gestures.RightMenuGesture(this); + break; - case 'left': - this._gesture = new gestures.LeftMenuGesture(this); - break; - } - this._targetGesture = new gestures.TargetGesture(this); + case 'left': + this._gesture = new gestures.LeftMenuGesture(this); + break; + } + this._targetGesture = new gestures.TargetGesture(this); + }); } /** diff --git a/ionic/components/menu/test/basic/index.ts b/ionic/components/menu/test/basic/index.ts index 60f4d341a6..fe9f1043cf 100644 --- a/ionic/components/menu/test/basic/index.ts +++ b/ionic/components/menu/test/basic/index.ts @@ -40,6 +40,7 @@ class E2EApp { constructor(app: IonicApp) { this.app = app; this.rootView = Page1; + this.changeDectionCount = 0; this.pages = [ { title: 'Page 1', component: Page1 }, @@ -62,4 +63,9 @@ class E2EApp { onMenuOpening(ev) { console.log('onMenuOpening', ev); } + + isHidden() { + console.log('Change detection', ++this.changeDectionCount); + return false; + } } diff --git a/ionic/components/menu/test/basic/main.html b/ionic/components/menu/test/basic/main.html index 7a4b0f7e49..fdc6844cf3 100644 --- a/ionic/components/menu/test/basic/main.html +++ b/ionic/components/menu/test/basic/main.html @@ -12,7 +12,7 @@ {{p.title}} -