Aurelia: if binding and content selectors

Andrew Walker

I have found content selectors don't seem to work when an if binding is used on a parent element. For example:

some-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>

This works fine if I don't use the if binding, but will not render <content> when I do use the if binding. Is there something I'm doing wrong here or is there a way to get this to work as expected?

Ashley Grant

I'll be adding this to our documentation soon, but for now, here is @EisenbergEffect's explanation from https://github.com/aurelia/framework/issues/375

"No. That is a characteristic of the shadow dom. The content selection points have to be static. They cannot be added ore removed dynamically. If you want to hid them, then consider using show.bind instead."

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related