feat(menuClose): menu close directive

This commit is contained in:
Adam Bradley
2015-09-29 11:03:38 -05:00
parent efa79da1a2
commit 0f136e9586

View File

@@ -0,0 +1,36 @@
import {Directive, ElementRef} from 'angular2/angular2';
import {Ion} from '../ion';
import {IonicApp} from '../app/app';
/**
* TODO
*/
@Directive({
selector: '[menu-close]',
properties: [
'menuClose'
],
host: {
'(click)': 'close($event)'
}
})
export class MenuToggle extends Ion {
constructor(
app: IonicApp,
elementRef: ElementRef
) {
super(elementRef, null);
this.app = app;
}
close(ev) {
let menu = this.app.getComponent(this.menuClose || 'menu');
menu && menu.close();
ev.preventDefault();
ev.stopPropagation();
}
}