fix menu component unregister

This commit is contained in:
Adam Bradley
2015-09-13 20:01:11 -05:00
parent f7a3a2436b
commit ebe2a836bc
2 changed files with 11 additions and 10 deletions

View File

@@ -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];
}
/**

View File

@@ -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;
}