O'Reilly logo

Meteor: Full-Stack Web Application Development by Marcelo Reyna, Isaac Strack, Fabian Vogelsteller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using dynamic templates

Meteor has yet another templating trick up its sleeve! In addition to custom code blocks, reactive data contexts, and all the other various template niceties, Meteor also allows you to dynamically switch between rendered templates. This recipe will show you how to dynamically render templates, using the Template.dynamic helper.

Getting ready

We will use the codebase from the Creating custom components recipe found in this chapter. Please follow that recipe first or download the corresponding codebase.

How to do it...

We will add a dynamic template that will switch our shapes from circles to squares, when rendered. Proceed with the following steps to use dynamic templates:

  1. First, we need to create our alternate template. Inside ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required