iron-meteor / iron-router

A client and server side router designed specifically for Meteor.
MIT License
1.98k stars 413 forks source link

loadingTemplate and layoutTemplate do not work together #1521

Open WayneUong opened 8 years ago

WayneUong commented 8 years ago
Router.route('/post', {
    name: 'postRoute',
    loadingTemplate: 'loadingLayout',
    layoutTemplate: 'mainLayout',
    waitOn: function () {
        return Meteor.subscribe('waitForAWhile')
    },
    action: function () {
        console.log('done!');
    }
});

Above code will not render loadingLayout while the subscription is going on

nemq commented 8 years ago

Hey, do you use {{>yield}} in your layout template? I run similar setup, just loading template is set globally for all routes and it works fine.

WayneUong commented 8 years ago

I think loadingTemplate is set as a default template to {{> yield}}, and layoutTemplate is a default layout set to <body>. And I set a name for every yield. That's probably why it's not working. Are these assumptions correct?

nemq commented 8 years ago

Yes, i did same mistake. You must have bare {{> yield}} in template for loading to work.