Last active
December 21, 2015 03:29
-
-
Save booyaa/6243041 to your computer and use it in GitHub Desktop.
server/publish.js
This file contains hidden or 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
Meteor.publish('typeahead', function() { | |
var typeAheadList = Lists.findOne({name: 'Typeahead'}); | |
console.log('typeahead %s', typeAheadList._id); | |
var words = Todos.find({list_id : typeAheadList._id}); | |
console.log('doc count %d', words.count()); | |
words.forEach(function(item) { | |
console.log('%s ', item.text); | |
}); | |
return words; | |
}); |
This file contains hidden or 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
// client side code | |
Meteor.subscribe('typeahead'); | |
TypeAhead = new Meteor.Collection("typeahead"); | |
// helper that i add to a bootstrap input with typeahead enabled | |
Template.todos.typeahead = function () { | |
var typeAheadList = TypeAhead.find(); | |
console.log('collar felt %s', JSON.stringify(typeAheadList)); | |
return JSON.stringify(typeAheadList); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment