Any way of detecting subscriptions being ready in the Template.templateName.rendered function?


#1

As what the title says, or even in the helpers area? I find myself needing to use a slight delay before running anything that needs to refer to data in the subscriptions, especially when it involves getting data for a Selectpicker-enabled JQuery select plugin.


#2

You can try new Blaze subcriptions ready for instance, any way your schema would looks like

Template.Posts.rendered = ->
    self = @
    self.$selectElement = self.$('#my-select')
    self.autorun = ->
        Meteor.subscribe 'serverPosts', () ->
            # do the stuff here...
            self.$selectElement.selectPluginInit()

PS: coffee to js (if you prefer) gere enter link description here