Search code examples
meteoriron-router

What is the iron:router 1.0 equivalent of this.setLayout() and this.lookupLayoutTemplate()?


Calling this.setLayout() or this.lookupLayoutTemplate(), for instance in this example:

https://github.com/EventedMind/iron-router/issues/655

gives:

Exception in callback of async function: TypeError: undefined is not a function

Solution

    • this.setLayout is now this.layout().
    • this.lookupLayoutTemplate is now Router.lookupLayoutTemplate

    Also take note that onBeforeAction now has three arguments:

    Router.onBeforeAction(function(req, res, next) {  
    
      next(); // or this.next(); 
              // still the same as pause().. 
              // you MUST call next so the route renders.
    });