Skip to content

Components don't get attached if transcluded in parent components that have v-if #684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cheapsteak opened this issue Jan 21, 2015 · 0 comments

Comments

@cheapsteak
Copy link
Contributor

The transcluded component is rendered in the DOM but the attached event never fires.

Fiddle: http://jsfiddle.net/6Lt7kc94/3/

parent component
<div v-component="child">
    <div v-component="transcluded"></div>
</div>
child component (visible is hardcoded to true)
<div v-if="visible">
    <content></content>
</div>
transcluded component
var globals = {};
var transcludedComponent = Vue.extend({
    template: "<div>blarg</div>",
    compiled: function () {
        globals.el = this.$el;
        // globals.el ends up inside a #document-fragment
    },
    attached: function () {
        alert('attached');
    }
});

If v-if="visible" is deleted then everything works.
Am I using this incorrectly or is this a bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants