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

Updating Blaze templates without Mongo


Not everything in our UI has to be dependent on Mongo collections. We can, in fact, use pretty much any reactive object inside our templates, and changes will appear instantly. This recipe will quickly show you how to use custom collections to populate and update UI templates.

Getting ready

Let's start with a base Meteor project and add the bootstrap and reactive-var packages. In a terminal window, navigate to where you would like your project to reside and enter the following commands:

$ meteor create mongoless
$ cd mongoless
$ meteor add twbs:bootstrap
$ meteor add reactive-var
$ meteor

Finally, open a browser and navigate to http://localhost:3000 so that you can see updates in real time.

How to do it…

We will create a simple array of button press snapshots, with a new element being added to the array every time the button on the page is clicked. Subsequently, these buttons will be added to the UI using a {{#each}} template block.

  1. First, open mongoless...