O'Reilly logo

Meteor Cookbook by Isaac Strack

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 reactivity with HTML attributes

One of the hidden gems in Meteor is the extremely granular control you have over how HTML is rendered. Blaze was designed in such a way that you can modify, add, or remove HTML element attributes dynamically without affecting anything else in the DOM! This recipe will walk you through the use of dynamic, reactive data inside element attributes.

Getting ready

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

How to do it…

Proceed with the following steps to use reactivity with HTML attributes:

  1. We first need to create a new navcolor template. Open navbar.html in your [project root]/client ...

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