mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(menuClose): menu close directive
This commit is contained in:
36
ionic/components/menu/menu-close.ts
Normal file
36
ionic/components/menu/menu-close.ts
Normal 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();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user