diff --git a/lib/components.js b/lib/components.js index 58c92b6d5..6d380fd09 100644 --- a/lib/components.js +++ b/lib/components.js @@ -164,7 +164,7 @@ App.prototype.component = function(viewName, constructor, ns) { if (typeof viewName === 'function') { constructor = viewName; viewName = null; - } else if (typeof viewName === 'object') { + } else if (viewName != null && typeof viewName === 'object') { var keys = Object.keys(viewName); if (keys.length == 1) { constructor = viewName[keys[0]]; @@ -191,7 +191,7 @@ App.prototype.component = function(viewName, constructor, ns) { if (constructor.prototype.name) { viewName = constructor.prototype.name; if (ns) - viewName = ns + ':' + viewName; + viewName = ns + ':' + viewName; var view = this.views.register(viewName); view.template = templates.emptyTemplate; } else { @@ -207,9 +207,8 @@ App.prototype.component = function(viewName, constructor, ns) { // Load sub components var subComponents = constructor.prototype.components; if (subComponents) { - console.log("loading components: ", subComponents); for(var i = 0, len = subComponents.length; i < len; i++) { - this.component(null, subComponents[i], viewName); + this.component(subComponents[i], null, viewName); } }