Last active
August 29, 2015 14:01
-
-
Save dohomi/d3f23cd784b066cadef7 to your computer and use it in GitHub Desktop.
Simple filter over collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Template.exerciseList.events({ | |
"keyup .js-exercise-text-search": function (ev, templ) { | |
Session.set("ExerciseListFilter", {"name": {$regex: ev.currentTarget.value, $options: 'i'}}); | |
} | |
}); | |
Template.exerciseList.helpers({ | |
exercises: function () { | |
Session.set("ExerciseListFilter", {}); | |
return TP.Collections.Exercises.find(Session.get("ExerciseListFilter")); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="exerciseList"> | |
<form name="exercise-list-search" class="js-exercise-list-search" role="form"> | |
<input type="text" class="js-exercise-text-search form-control" /> | |
</form> | |
{{#each exercises}} | |
{{> exerciseListItem}} | |
{{/each}} | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment