Skip to content

Commit

Permalink
fix(ng2.uiView): Dispose prev comp on empty viewconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Apr 3, 2016
1 parent b1624c6 commit f28e0c3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ng2/uiView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ const getProviders = (injector) => {
}`
],
template: `<div #content></div>`,
// debugtemplate: `
// template: `
// <div style="padding: 1em; border: 1px solid lightgrey;">
//
// <div #content style="color: lightgrey; font-size: smaller;">
// <div>ui-view #{{uiViewData.id}} created by '{{ parentContext.name || "(root)" }}' state</div>
// <div>name: (absolute) '{{uiViewData.fqn}}' (contextual) '{{uiViewData.name}}@{{parentContext.name}}' </div>
// <div>currently filled by: '{{(uiViewData.config && uiViewData.config.context) || 'empty...'}}'</div>
// <div>currently filled by: '{{(uiViewData.config && uiViewData.config.viewDecl.$context) || 'empty...'}}'</div>
// </div>
//
// </div>`
Expand Down Expand Up @@ -90,7 +90,10 @@ export class UiView {
}

viewConfigUpdated(config: ViewConfig) {
if (!config) return; // TODO do something smarter
if (!config) {
return this.disposeLast();
}

let {uiViewData, injector, dcl, elementRef} = this;
let viewDecl = <Ng2ViewDeclaration> config.viewDecl;

Expand Down

0 comments on commit f28e0c3

Please sign in to comment.