From ec1c53421193c61eede5157114b3862e1316f28b Mon Sep 17 00:00:00 2001 From: Chris Thielen Date: Tue, 5 Apr 2016 18:49:44 -0500 Subject: [PATCH] fix(view): only run ng1 route-to-component code if component: is a string --- src/ng1/viewDirective.ts | 4 ++-- src/ng1/viewsBuilder.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ng1/viewDirective.ts b/src/ng1/viewDirective.ts index 9bfe85c2d..24d6e80ba 100644 --- a/src/ng1/viewDirective.ts +++ b/src/ng1/viewDirective.ts @@ -1,7 +1,7 @@ /** @module ng1_directives */ /** for typedoc */ "use strict"; import {extend, map, unnestR, filter} from "../common/common"; -import {isDefined, isFunction} from "../common/predicates"; +import {isDefined, isFunction, isString} from "../common/predicates"; import {trace} from "../common/trace"; import {ActiveUIView} from "../view/interface"; import {Ng1ViewConfig} from "./viewsBuilder"; @@ -357,7 +357,7 @@ function $ViewDirectiveFill ( $compile, $controller, $transitions, $view, } // Wait for the component to appear in the DOM - if (cfg.viewDecl.component) { + if (isString(cfg.viewDecl.component)) { let cmp = cfg.viewDecl.component; let kebobName = kebobString(cmp); let getComponentController = () => { diff --git a/src/ng1/viewsBuilder.ts b/src/ng1/viewsBuilder.ts index c2eba3172..d8da74f6f 100644 --- a/src/ng1/viewsBuilder.ts +++ b/src/ng1/viewsBuilder.ts @@ -49,7 +49,8 @@ export function ng1ViewsBuilder(state: State) { config.templateProvider = ['$injector', function($injector) { const resolveFor = key => config.bindings && config.bindings[key] || key; const prefix = angular.version.minor >= 3 ? "::" : ""; - let attrs = getComponentInputs($injector, config.component).map(key => `${kebobString(key)}='${prefix}$resolve.${resolveFor(key)}'`).join(" "); + let attrs = getComponentInputs($injector, config.component) + .map(key => `${kebobString(key)}='${prefix}$resolve.${resolveFor(key)}'`).join(" "); let kebobName = kebobString(config.component); return `<${kebobName} ${attrs}>`; }];