Meteor Iron Router Wait for template to be rendered

Viewed 1992

Is there anyway to wait for template to be rendered and then execute certain function?

I have tried after and it doesn't work.

Router.map(function () {
  this.route('post', {
    path: '/posts/:ll',

    action: function () {
      this.render('home');
    },

    after: function () {
      var n = this.params.ll
       UI.insert(UI.render(Template[n]), document.getElementById("child"))
    }
  });
});

Turns out the child element doesn't exist yet because the 'home' template isn't yet rendered when the after function is fired.

Any suggestion or work around is highly appreciated.

2 Answers
Related