mongodb - Meteor Routing and subsequent data order -
i got stuck @ understanding meteor routes , data flow.
in beginning simple blog app, 1 collection named posts.
now want store history of changes, i've created second collection , named history.
on every edit in posts i'm adding state of post (author,content, etc ...) history including id of edited post.
question how should configure iron router make pass current post id posts/:_id/history previous state (posts/:_id/) , entries history matching id?
to pass id 1 view next, can via template so:
<a href="/posts/1/history>post history</a> or
<a href="/posts/{{_id}}/history>post history</a> or programmatically so:
router.go('posthistory', {_id: 1}); to history entries, can resolve data in iron router during route request so:
this.route('posthistory', { path: '/posts/:_id/history', data: function() { return history.findone({postid: this.params._id}); } });
Comments
Post a Comment