Not rendering content of <content />?


#1

We have some issues with the usage of the element in can-components. Unfortunately I was not able to reproduce the issue in a fiddle yet, here is a simple, working example. It is more or less C/P from the documentation.

When I try to debug this I’m looking at these places: can-component and can-stache, but I don’t get the right point, where it fails. Can you please give some background for these parts of the code or could you point me to the lines, where the actual replacement of <content /> must take place?

Our stache-files are actually simple: we have one component, which has

<ul class="dropdown-menu dropdown-menu-right dropdown-list"><content/></ul>

and some more stuff around this. Then we use this component like this

<wrapping-dropdown-comp class="dropdown" vm:sSomeAttribute:bind="bSomeMode">
    {{#if(bSomeMode)}}
        {{>registered-partial-one}

        <li>An entry</li>

        {{>registered-partial-two}}
    {{/if}}

    <!-- and so on -->
</wrapping-dropdown-comp>

All partials have been registered. And the whole stuff does work sometimes, sometimes it does not. Any help is appreciated.


#2

Do you have an error that is being thrown that is caught by a promise? I’ve seen this cause similar problems.

I’ll share the code later today when I’m by my computer.


#3

There was no visible error.

We fixed the problem by using can-slot / can-template (named of course) instead of content, this seems to be more reliable.

Thanks anyway!