fix(menuClose): put in ionic directives

This commit is contained in:
Adam Bradley
2015-09-29 11:45:44 -05:00
parent 0f136e9586
commit 52bf1f8520
5 changed files with 19 additions and 17 deletions

View File

@ -13,6 +13,7 @@ export * from 'ionic/components/item/item-group'
export * from 'ionic/components/menu/menu'
export * from 'ionic/components/menu/menu-types'
export * from 'ionic/components/menu/menu-toggle'
export * from 'ionic/components/menu/menu-close'
export * from 'ionic/components/text-input/text-input'
export * from 'ionic/components/text-input/label'
export * from 'ionic/components/list/list'

View File

@ -13,10 +13,10 @@ import {IonicApp} from '../app/app';
'menuClose'
],
host: {
'(click)': 'close($event)'
'(click)': 'close()'
}
})
export class MenuToggle extends Ion {
export class MenuClose extends Ion {
constructor(
app: IonicApp,
@ -26,11 +26,9 @@ export class MenuToggle extends Ion {
this.app = app;
}
close(ev) {
close() {
let menu = this.app.getComponent(this.menuClose || 'menu');
menu && menu.close();
ev.preventDefault();
ev.stopPropagation();
}
}

View File

@ -15,7 +15,7 @@ import {Navbar} from '../nav-bar/nav-bar';
'menuToggle'
],
host: {
'(click)': 'toggle($event)',
'(click)': 'toggle()',
'[hidden]': 'isHidden'
}
})
@ -37,11 +37,9 @@ export class MenuToggle extends Ion {
* TODO
* @param {TODO} event TODO
*/
toggle(ev) {
toggle() {
let menu = this.app.getComponent(this.menuToggle || 'menu');
menu && menu.toggle();
ev.preventDefault();
ev.stopPropagation();
}
get isHidden() {

View File

@ -12,7 +12,7 @@ import {NavRegistry} from './nav-registry';
'params: navParams'
],
host: {
'(click)': 'onClick($event)',
'(click)': 'onClick()',
'role': 'link'
}
})
@ -26,7 +26,7 @@ export class NavPush {
this.registry = registry;
}
onClick(event) {
onClick() {
let destination, params;
if (this.instruction instanceof Array) {
@ -44,17 +44,18 @@ export class NavPush {
destination = this.registry.get(destination);
}
this.nav.push(destination, params);
this.nav && this.nav.push(destination, params);
}
}
/**
* TODO
*/
@Directive({
selector: '[nav-pop]',
host: {
'(click)': 'onClick($event)',
'(click)': 'onClick()',
'role': 'link'
}
})
@ -66,7 +67,7 @@ export class NavPop {
constructor(nav: NavController) {
this.nav = nav;
}
onClick(event) {
this.nav.pop();
onClick() {
this.nav && this.nav.pop();
}
}

View File

@ -4,7 +4,8 @@ import * as util from 'ionic/util';
import {IonicConfig} from './config';
import {ionicBootstrap} from '../components/app/app';
import {
Menu, MenuToggle, Button, Content, Scroll, Refresher,
Menu, MenuToggle, MenuClose,
Button, Content, Scroll, Refresher,
Slides, Slide, SlideLazy,
Tabs, Tab,
Card, List, ListHeader, Item, ItemGroup, ItemGroupTitle,
@ -14,7 +15,8 @@ import {
TextInput, TextInputElement, Label,
Segment, SegmentButton, SegmentControlValueAccessor,
RadioGroup, RadioButton, SearchBar,
Nav, NavbarTemplate, Navbar, NavPush, NavPop, NavRouter,
Nav, NavbarTemplate, Navbar,
NavPush, NavPop, NavRouter,
IdRef,
ShowWhen, HideWhen
} from '../ionic';
@ -34,6 +36,7 @@ export const IONIC_DIRECTIVES = [
// Content
forwardRef(() => Menu),
forwardRef(() => MenuToggle),
forwardRef(() => MenuClose),
forwardRef(() => Button),
forwardRef(() => Content),
@ -81,6 +84,7 @@ export const IONIC_DIRECTIVES = [
forwardRef(() => Nav),
forwardRef(() => NavbarTemplate),
forwardRef(() => Navbar),
forwardRef(() => NavPush),
forwardRef(() => NavPop),
forwardRef(() => NavRouter),