diff --git a/packages/runtime/src/resources/custom-attributes/if.ts b/packages/runtime/src/resources/custom-attributes/if.ts index d9576c5b2e..fc4ddc8ff4 100644 --- a/packages/runtime/src/resources/custom-attributes/if.ts +++ b/packages/runtime/src/resources/custom-attributes/if.ts @@ -293,7 +293,13 @@ export class Else { container.register(Registration.transient('custom-attribute:else', this)); } - public link(ifBehavior: If): void { - ifBehavior.elseFactory = this.factory; + public link(ifBehavior: If | IController): void { + if (ifBehavior instanceof If) { + ifBehavior.elseFactory = this.factory; + } else if (ifBehavior.viewModel instanceof If) { + ifBehavior.viewModel.elseFactory = this.factory; + } else { + throw new Error(`Unsupported IfBehavior`); // TODO: create error code + } } }