Permalink
Browse files

fix(if-else): Fixed typo and removed obsolete error

  • Loading branch information...
fragsalat committed Oct 18, 2017
1 parent 39fb831 commit 18a4e7e2fcd1a3befee28db0c8400d6483d870d0
Showing with 4 additions and 9 deletions.
  1. +1 −6 src/else.js
  2. +3 −3 src/if.js
View
@@ -13,11 +13,6 @@ export class Else extends IfCore {
bind(bindingContext, overrideContext) {
super.bind(bindingContext, overrideContext);
if (!this.ifVm) {
throw new Error('There must be a node with an if attribute before the else attribute');
}
this.ifVm.conditionChanged(this.ifVm.condition);
}
@@ -35,6 +30,6 @@ export class Else extends IfCore {
throw new Error("Can't find matching If for Else custom attribute.");
}
this.ifVm = previous.au.if.viewModel;
this.ifVm.else = this;
this.ifVm.elseVm = this;
}
}
View
@@ -21,7 +21,7 @@ export class If extends IfCore {
bind(bindingContext, overrideContext) {
super.bind(bindingContext, overrideContext);
// Else attribute will trigger change when it's bound
if (!this.else || this.else.isBound) {
if (!this.elseVm || this.elseVm.isBound) {
this.conditionChanged(this.condition);
}
}
@@ -40,8 +40,8 @@ export class If extends IfCore {
}
let promise;
if (this.else) {
promise = show ? this._swap(this.else, this) : this._swap(this, this.else);
if (this.elseVm) {
promise = show ? this._swap(this.elseVm, this) : this._swap(this, this.elseVm);
} else {
promise = show ? this._show() : this._hide();
}

0 comments on commit 18a4e7e

Please sign in to comment.