Book Image

Building Single-page Web Apps with Meteor

By : Fabian Vogelsteller
Book Image

Building Single-page Web Apps with Meteor

By: Fabian Vogelsteller

Overview of this book

Table of Contents (21 chapters)
Building Single-page Web Apps with Meteor
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Spacebars syntax


To wrap it all up, lets summarize the Spacebars syntax:

Helper

Description

{{myProperty}}

The template helper can be a property from the template's data context or a template helper function. If a helper function and a property with the same name exist, the template helper will use the helper function instead.

{{> myTemplate}}

The inclusion helper is for a template and always expects a template object or null.

{{> Template.dynamic template=templateName [data=dataContext]}}

With the {{> Template.dynamic ...}} helper, you can render a template dynamically by providing a template helper returning a template name for the template parameter. When the helper would rerun and return a different template name, it will replace the template on this position with the new one.

{{#myBlockHelper}}

...

{{/myBlockHelper}}

A block helper that contains both HTML and the Spacebars syntax.

By default, Spacebars comes with the following four default block helpers:

  • {{#if}}..{...