Skip to content

Instantly share code, notes, and snippets.

@sas1ni69
Last active August 29, 2015 14:12
Show Gist options
  • Save sas1ni69/6663f7d3ce576ed76136 to your computer and use it in GitHub Desktop.
Save sas1ni69/6663f7d3ce576ed76136 to your computer and use it in GitHub Desktop.
Books = new Mongo.Collection('books');
if (Meteor.isClient) {
Template.books.helpers({
books: function(){
var filter = Session.get('filter');
return Books.find({ title: new RegExp(filter, 'i') });
}
});
Template.searchbar.events({
'keyup #searchbox': function(evnt, tmpl){
Session.set('filter', $('#searchbox').val());
}
});
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment