Reputation: 6577
I am looking for a way to wait before rendering anything when a waitOn argument is given.
Currently it works perfectly with the recommended way:
use onBeforeAction ('loading')
use action : function (if (this.ready()) this.render())
waitOn : function () {return [Meteor.subscribe()...]}
So when rendering the routing template the render process waits. But when I include a Template in the main-template the "sub"-Template will be rendered BEFORE the waitOn options ends.
So what is the recommended way to tell the iron-router to wait for the waitOn ready-state before render all included templates and also all yield-sub-templates ?
Upvotes: 1
Views: 207
Reputation: 325
For me this works great:
this.route('note',{
path: '/note/:_id',
waitOn: function() { return Meteor.subscribe('notes')},
data: function() {
if( this.ready() ){ this.render();
return Notes.findOne(this.params._id);
}else{this.render('loading') }}
});
No content flashing or anything.
But also would like to know of how the guru's deal with it.
Upvotes: 0