Skip to content

Commit

Permalink
fix(compose): activate not called on string vm's after initial compose
Browse files Browse the repository at this point in the history
Fixes #15
  • Loading branch information
EisenbergEffect committed Mar 21, 2015
1 parent 154feb0 commit 62c1921
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/compose.js
Expand Up @@ -25,13 +25,15 @@ export class Compose {
}

modelChanged(newValue, oldValue){
if(this.viewModel && typeof this.viewModel.activate === 'function'){
this.viewModel.activate(newValue);
var vm = this.currentViewModel;

if(vm && typeof vm.activate === 'function'){
vm.activate(newValue);
}
}

viewChanged(newValue, oldValue){
processInstruction(this, { view:newValue, viewModel:this.viewModel, model:this.model });
processInstruction(this, { view:newValue, viewModel:this.currentViewModel || this.viewModel, model:this.model });
}

viewModelChanged(newValue, oldValue){
Expand All @@ -45,8 +47,9 @@ function processInstruction(composer, instruction){
container:composer.container,
viewSlot:composer.viewSlot,
viewResources:composer.viewResources,
currentBehavior:composer.current
currentBehavior:composer.currentBehavior
})).then(next => {
composer.current = next;
composer.currentBehavior = next;
composer.currentViewModel = next.executionContext;
});
}

0 comments on commit 62c1921

Please sign in to comment.