Meteor: How do I adjust iron router return data based on search query? -


i have app users can take notes.

in html page iterate on each note so:

<div id="notes-container" class="notes">   {{each notes}}     {{> note}}    {{/each}} </div> 

and in router file return data so:

@route: 'notes'.   path: '/notes/:_id',   data: ->       notes = notes.find           threadid: @params._id           trash:             $exists: false         ,           sort:              date: -1 

all typical meteor stuff far. confused how adjust data iterated on in html page.

each notes has array field tags tags: ['apple' ,'red', 'green']

what if user wants return notes tag 'red'. there input box on site user enters tag , presses enter.

how can adjust data sent page queries mongodb return notes tag red? know how write query not sure how set though in meteor.

one way tried called same route query paramters like: '/notes/326363235474?tags=apple'

and in iron router can query parameters , return right set of documents when call original route again clear search, not load of original documents again.

any suggestion on how can set up? thanks

the data function needs return data want available within template context, if i'll define function route:

 data: ->         return drawing.findone             _id: window._drawing_id 

i have data in "this" object when proccessing template.


Comments

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -