Last active
August 29, 2015 14:12
-
-
Save sas1ni69/6663f7d3ce576ed76136 to your computer and use it in GitHub Desktop.
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
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