mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
37 lines
631 B
TypeScript
37 lines
631 B
TypeScript
import {Directive} from 'angular2/angular2';
|
|
|
|
import {IonicApp} from '../app/app';
|
|
|
|
/**
|
|
* TODO
|
|
*/
|
|
@Directive({
|
|
selector: '[menu-toggle]',
|
|
properties: [
|
|
'menuToggle'
|
|
],
|
|
host: {
|
|
'(click)': 'toggle($event)',
|
|
'button': ''
|
|
}
|
|
})
|
|
export class MenuToggle {
|
|
|
|
constructor(private app: IonicApp) {}
|
|
|
|
onInit() {
|
|
// Get the component with this toggleTarget tag, or use "menu" if none
|
|
this.menu = this.app.getComponent(this.menuToggle || 'menu');
|
|
}
|
|
|
|
/**
|
|
* TODO
|
|
* @param {TODO} event TODO
|
|
*/
|
|
toggle(ev) {
|
|
this.menu && this.menu.toggle();
|
|
ev.preventDefault();
|
|
ev.stopPropagation();
|
|
}
|
|
}
|