Skip to content

Commit

Permalink
fix(compose): properly handle the created callback during dynamic com…
Browse files Browse the repository at this point in the history
…position
  • Loading branch information
EisenbergEffect committed Jan 8, 2016
1 parent 24ce672 commit eddec88
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/compose.js
Expand Up @@ -2,7 +2,7 @@ import {Container, inject} from 'aurelia-dependency-injection';
import {TaskQueue} from 'aurelia-task-queue';
import {
CompositionEngine, ViewSlot, ViewResources,
customElement, bindable, noView
customElement, bindable, noView, View
} from 'aurelia-templating';
import {DOM} from 'aurelia-pal';

Expand Down Expand Up @@ -55,11 +55,20 @@ export class Compose {
this.currentViewModel = null;
}

/**
* Invoked when the component has been created.
*
* @param owningView The view that this component was created inside of.
*/
created(owningView: View) {
this.owningView = owningView;
}

/**
* Used to set the bindingContext.
*
* @param {bindingContext} bindingContext The context in which the view model is executed in.
* @param {overrideContext} overrideContext The context in which the view model is executed in.
* @param bindingContext The context in which the view model is executed in.
* @param overrideContext The context in which the view model is executed in.
*/
bind(bindingContext, overrideContext) {
this.bindingContext = bindingContext;
Expand Down Expand Up @@ -154,6 +163,7 @@ function createInstruction(composer, instruction) {
return Object.assign(instruction, {
bindingContext: composer.bindingContext,
overrideContext: composer.overrideContext,
owningView: composer.owningView,
container: composer.container,
viewSlot: composer.viewSlot,
viewResources: composer.viewResources,
Expand Down

0 comments on commit eddec88

Please sign in to comment.