【发布时间】:2017-11-03 02:40:08
【问题描述】:
我在我的应用程序中使用 aurelia compose,如下所示:
<compose view-model="childViewModel" model="{myActivationParameters: ...}"></compose>
如何在childViewModel html 代码中访问父视图模型?
最后我希望能够在childViewModel.html中做到这一点
<span> ${ ParentViewModel.myProperty } and ${ RootViewModel.myOtherProperty } </span>
我正在寻找 aurelia 中的 knockoutJs $root 和 $parent。
编辑:我正在使用 aurelia 组合而不是自定义组件。不是重复的。
【问题讨论】:
-
你试过$parent吗?
<span> ${ $parent.myProperty } and ${ RootViewModel.myOtherProperty } </span> -
@JessedeBruijne 不是重复的。他使用 compose 元素,而不是自定义元素。
标签: aurelia