Raggamuffin
Raggamuffin

Reputation: 709

Template.subscriptionReady and Semantic UI Accordion Module

I'm using Meteor with semantic-ui and i have a list of items i'd like to display in an accordion.

The accordion itself works perfectly fine until i wrap a {{#if Template.subscriptionsReady}} around it. than it does not work anymore.

The initialized accordion:

Template.register.rendered = function() {
    this.$('.ui.accordion').accordion();
}

Question: How can i use a semantic-ui accordion inside a {{#if Template.subscriptionsReady}} ?

Upvotes: 0

Views: 69

Answers (1)

Michel Floyd
Michel Floyd

Reputation: 20236

Because the subscription is not ready when the template renders, $('.ui.accordion') will not select anything since that element is inside the {{#if Template.subscriptionsReady}} block.

You need to wait for the subscription to be ready and then run this.$('.ui.accordion').accordion() at that time.

Upvotes: 1

Related Questions