Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with Meteor.js JavaScript Framework - Second Edition

You're reading from   Getting Started with Meteor.js JavaScript Framework - Second Edition Learn to develop powerful web applications in minutes with Meteor

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781785285547
Length 138 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Let's create some templates

We'll now see a real-life example of reactive computations and work on our Lending Library at the same time. Adding categories through the console has been a fun exercise, but it's not a long-term solution. Let's make it so that we can do that on the page instead as follows:

  1. Open LendLib.html and add a new button just before the {{#each lists}} expression:
    <div id="categories" class="btn-group">
      <div class="category btn btn-primary" id="btnNewCat">
        <span class="glyphicon glyphicon-plus"></span>
      </div>
      {{#each lists}}
  2. This will add a plus button on the page, as follows:
    Let's create some templates
  3. Now, we want to change the button into a text field when we click on it. So let's build that functionality by using the reactive pattern. We will make it based on the value of a variable in the template.
  4. Add the following {{#if…else}} conditionals around our new button:
    <div id...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image