this.render() method is available only inside hooks.
Note
this.render() method is available only if application has templating and blaze, or blaze-html-templates packages installed
this.render(layout, template [, data, callback])
layout{String|Blaze.Template} - Blaze.Template instance or a name of layout template (which hasyield)template{String|Blaze.Template} - Blaze.Template instance or a name of template (which will be rendered into yield)data{Object} - [Optional] Object of data context to use in template. Will be passed to bothlayoutandtemplatecallback{Function} - [Optional] Callback triggered after template is rendered and placed into DOM. This callback has no context
this.render(template [, data, callback])
template{String|Blaze.Template} - Blaze.Template instance or a name of template (which will be rendered intobodyelement, or element defined inFlowRouter.Renderer.rootElement)data{Object} - [Optional] Object of data context to use in templatecallback{Function} - [Optional] Callback triggered after template is rendered and placed into DOM. This callback has no context
FlowRouter.onRenderError = function (error) { /* ... */ }; this callback called with single error argument:
error{Meteor.Error} — Reason.
Use FlowRouter.onRenderError to set global callback to catch errors like No such layout template and No such template. It's great workaround for dynamically loaded routes and templates, and might be triggered upon broken Internet connection, or when template not loaded for other reason. Here's recommended usage:
<template name="templatingError">
<h1>Oops, something went wrong</h1>
<p>Network or other error occurred, please try to <a href="#" onclick="window.location.href=window.location.href">reload this page</a> or go back to <a href="/">home page</a>.</p>
</template>import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
FlowRouter.onRenderError = function (error) {
console.error('[onRenderError]', error);
this.render('templatingError');
};- Made with animation performance in mind, all DOM interactions are wrapped into
requestAnimationFrame - In-memory rendering (a.k.a. off-screen rendering, virtual DOM), disabled by default, can be activated with
FlowRouter.Renderer.inMemoryRendering = true;
- Settings below is experimental, targeted to reduce on-screen DOM layout re-flow, speed up rendering on slower devices and Phones in first place, by moving DOM computation to off-screen (a.k.a. In-Memory DOM, Virtual DOM)
FlowRouter.Renderer.rootElement{Function} - Function which returns root DOM element where layout will be rendered, default:document.bodyFlowRouter.Renderer.inMemoryRendering{Boolean} - Enable/Disable in-memory rendering, default:falseFlowRouter.Renderer.getMemoryElement{Function} - Function which returns default in-memory element, default:document.createElement('div'). Usedocument.createDocumentFragment()to avoid extra parent elements- The default
document.createElement('div')will cause extra wrappingdivelement document.createDocumentFragment()won't cause extra wrappingdivelement but may lead to exceptions in Blaze engine, depends from your app implementation
- The default