Skip to content

Instantly share code, notes, and snippets.

@livoffgrid
Created May 15, 2012 18:33
Show Gist options
  • Select an option

  • Save livoffgrid/2704017 to your computer and use it in GitHub Desktop.

Select an option

Save livoffgrid/2704017 to your computer and use it in GitHub Desktop.
maintain selections in meteor
Template.days.travelMode = function() {
return ['DRIVING', 'BICYCLING', 'WALKING'];
}
Template.days.selected = function() {
return Session.equals('travelMode', this.toString()) ? 'selected' : '';
}
<template name='days'>
...
{{#each travelMode}}
<img id='{{this}}' class='mode {{selected}}' src='/{{this}}.png'>
{{/each}}
...
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment