Book Image

Meteor Cookbook

By : Isaac Strack
Book Image

Meteor Cookbook

By: Isaac Strack

Overview of this book

Table of Contents (19 chapters)
Meteor Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using inline data to modify UI elements reactively


Typically, when elements in an HTML page are rendered, then that rendering isn't directly linked to any of the data used to create them, for example, if we have an array of objects, we may generate some HTML by iterating over the array and adding <div> elements for each object in the array. Unless we do something to manually link them to the array of objects, these newly created elements aren't associated with the data that created them in any way. This leads to all kinds of development shenanigans, as developers try to shoehorn in associative data, which is used in events and other downstream functions. Long story short, using only existing web technologies, it's difficult to keep all of the data exactly in sync with your HTML DOM elements. Meteor has been designed to help solve this problem gracefully, keeping track of the context of each DOM element and therefore allowing instant access to the data used to create the element in...