Aurelia:如果绑定和内容选择器

时间:2016-03-27 14:58:53

标签: aurelia

我发现在父元素上使用if绑定时,内容选择器似乎不起作用。例如:

一些-element.html

<template>
  <div if.bind="true">
    This will appear
    <content></content>
  </div>
</template>

app.html

<template>
  <some-element>This will not appear</some-element>
</template>

如果我不使用if绑定,这可以正常工作,但在使用<content>绑定时不会呈现if。我在这里做错了什么,或者有没有办法让这个按预期工作?

1 个答案:

答案 0 :(得分:2)

我很快就会将其添加到我们的文档中,但是现在,来自https://github.com/aurelia/framework/issues/375的@ EisenbergEffect的解释

“不。这是影子dom的特征。内容选择点必须是静态的。它们不能被动态删除。如果你想隐藏它们,那么请考虑使用show.bind。”