Search code examples
meteoriron-router

Iron Router action not being called after adding waitOn


So I'm trying to use waitOn so my app doesn't render my templates until the data is ready.

here is my code:

Router.configure

    loadingTemplate: 'loading'

Router.map ->

    @route 'burgers',
        path   : '/burgers'
        waitOn : -> Meteor.subscribe 'burgers'
        data   : -> burgers: BurgerList.find {}, sort: votes: -1
        action : ->
            if @ready()
                @render 'burgers'

After adding the waitOn function nothing is being rendered. The action function isnt even being called.

Any ideas where I'm going wrong?

Thanks!


Solution

  • It looks like you forgot to publish burgers, Use Meteor.publish().