From 4a58321beb061e21fa6392eb7172e69b0d73da8f Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Fri, 18 Sep 2015 11:44:18 -0500 Subject: [PATCH] throw error for view controller push Closes #138 --- ionic/components/nav/nav.ts | 3 +++ ionic/components/view/view-controller.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ionic/components/nav/nav.ts b/ionic/components/nav/nav.ts index 9c16a21ac8..729eba6fe3 100644 --- a/ionic/components/nav/nav.ts +++ b/ionic/components/nav/nav.ts @@ -44,6 +44,9 @@ export class Nav extends ViewController { super.onInit(); if (this.root) { + if (typeof this.root !== 'function') { + throw 'The [root] property in must be given a reference to a component class from within the constructor.'; + } this.push(this.root); } diff --git a/ionic/components/view/view-controller.ts b/ionic/components/view/view-controller.ts index e33c19af67..1c10f197a6 100644 --- a/ionic/components/view/view-controller.ts +++ b/ionic/components/view/view-controller.ts @@ -64,6 +64,9 @@ export class ViewController extends Ion { if (!componentType || !this.app.isEnabled()) { return Promise.reject(); } + if (typeof componentType !== 'function') { + throw 'Loading component must be a component class, not "' + componentType.toString() + '"'; + } let resolve; let promise = new Promise(res => { resolve = res; });