Skip to content

Instantly share code, notes, and snippets.

@panw
Last active August 29, 2015 14:04
Show Gist options
  • Save panw/e79d451e5565557fd94c to your computer and use it in GitHub Desktop.
Save panw/e79d451e5565557fd94c to your computer and use it in GitHub Desktop.
For Part 5 of the tutorial. Added an input field and add button to give users the functionality to add items to the list.
<head>
<title>Grocery List</title>
</head>
<body>
<!-- render template name groceryList -->
{{> groceryList}}
</body>
<!-- define template name groceryList -->
<template name="groceryList">
<!-- A place for users enter a new item and add it to the list -->
<input type="text" id="new-item" name="new-item" placeholder="Add an item..."><input type="submit" id="add-button" value="Add">
<ul>
<!-- loop through all entries in the Item Collection -->
{{#each items}}
<!-- render the current items name -->
<li class="list-item" id="{{_id}}"><input type="checkbox" value="{{name}}">{{name}}</li>
{{/each}}
</ul>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment