简体   繁体   中英

How to not display the default template in one of the routes in Meteor Iron-Router?

I'm trying to render my home template without the default layoutTemplate . Iron-router Guide shows I need to use Router.onBeforeAction . I just can't figure out how exactly to implement it.

Router.configure({
 layoutTemplate: 'navbar'

}

Router.route('/', {name: 'home'});

You can override the default layout template by calling this.layout(); in your route. Either you supply a different layout template, eg this.layout('homeLayout'); or you just leave the arguments empty.

For example:

Router.route('/', function () {
    this.layout();
    this.render('home');
}, {name: 'home'});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM