Meteor Iron Router Wait for the pattern to display

Can I wait for the template to be rendered, and then perform a specific function?

I tried 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 off the child does not exist yet, because the "home" template is not yet displayed when the after function is run.

Any suggestion or work is welcome.

+4
source share
2 answers

Can you do this:

action: function () {
  this.render('home');
  Template.home.rendered = function() {
    // ...
    Template.home.rendered = null;
  };
},
+7
source

All Articles