Skip to content

Commit

Permalink
fix(view): only run ng1 route-to-component code if component: is a st…
Browse files Browse the repository at this point in the history
…ring
  • Loading branch information
christopherthielen committed Apr 5, 2016
1 parent 3fc2012 commit ec1c534
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ng1/viewDirective.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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 = () => {
Expand Down
3 changes: 2 additions & 1 deletion src/ng1/viewsBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}></${kebobName}>`;
}];
Expand Down

0 comments on commit ec1c534

Please sign in to comment.