A Meteor Blaze powered Layout component for dynamic rendering and data. Its major features are:
- Dynamically set the layout template and data context.
- Define yield regions to dynamically render templates into.
- Never re-render templates unless they change
<body>
{{#Layout template="MyLayout"}}
This content will go into the main yield region.
{{#contentFor region="footer"}}
This is some footer content
{{/contentFor}}
{{/Layout}}
</body>
<template name="MyLayout">
<h1>My Layout</h1>
<div>
{{> yield}}
</div>
<footer>
{{> yield region="footer"}}
</footer>
</template>
var layout = UI.render(Layout.extend({template: 'MyLayout'});
UI.DomRange.insert(layout.dom, document.body);
// set the layout template
layout.template('AnotherLayoutTemplate');
// set the layout data context
layout.setData({title: 'Some data context'});
// render a template into the main region {{> yield}}
layout.setRegion('SomeTemplateName');
// render a template into a named region
layout.setRegion('footer', 'SomeFooterTemplate');
This package is automatically included with Iron Router.