From ebe2a836bcbbbd3b55f0e1452fb3f2ace4fa5309 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Sun, 13 Sep 2015 20:01:11 -0500 Subject: [PATCH] fix menu component unregister --- ionic/components/app/app.ts | 16 ++++++++-------- ionic/components/menu/menu.ts | 5 +++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ionic/components/app/app.ts b/ionic/components/app/app.ts index f9b20ad4ff..7ded2f46db 100644 --- a/ionic/components/app/app.ts +++ b/ionic/components/app/app.ts @@ -132,22 +132,22 @@ export class IonicApp { /** * Register a known component with a key, for easy lookups later. - * @param {TODO} key The key to use to register the component + * @param {TODO} id The id to use to register the component * @param {TODO} component The component to register */ - register(key, component) { - if (this.components[key]) { - throw Error('Registered component key ' + key + ' already exists.'); + register(id, component) { + if (this.components[id]) { + throw Error('Registered component id "' + id + '" already exists.'); } - this.components[key] = component; + this.components[id] = component; } /** * Unregister a known component with a key. - * @param {TODO} key The key to use to unregister + * @param {TODO} id The id to use to unregister */ - unregister(key) { - delete this.components[key]; + unregister(id) { + delete this.components[id]; } /** diff --git a/ionic/components/menu/menu.ts b/ionic/components/menu/menu.ts index c13b8dd136..e9070a3cc9 100644 --- a/ionic/components/menu/menu.ts +++ b/ionic/components/menu/menu.ts @@ -54,7 +54,8 @@ export class Menu extends Ion { if (!this.id) { // Auto register - this.app.register('menu', this); + this.id = 'menu'; + this.app.register(this.id, this); } this._initGesture(); @@ -230,7 +231,7 @@ export class Menu extends Ion { } onDestroy() { - this.app.unregister(this); + this.app.unregister(this.id); this._type && this._type.onDestroy(); this.contentElement = null; }