meteor - Redirecting page with Iron-Router -
currently using accounts packages supplied meteor allow people sign site working on. want allow users have bio page, whenever logged particular person side bar navigation appears lot of links 1 of says "bio". want bio redirect me home page bio page i.e:
localhost:3000/ -> localhost:3000/bio/userid23453423434
currently write using iron-router this:
... <li><a href="{{pathfor 'bio'}}">bio</a></li> ...
and in router have:
router.map(function() { ... this.route('bio', {path: '/bio/:_id', data: function () { return {_id: meteor.userid()} } }); ...
but when click on link not redirected anywhere. ideas doing wrong?
you don't need parameter _id in path since using meteor.userid(). iron-router won't render if can't find _id parameter in template. removing fix issue:
router.map(function() { ... this.route('bio', {path: '/bio', data: function () { return {_id: meteor.userid()} } }); ...
if want keep path _id should render using {{#with}} set data context, {{pathfor 'bio'}}
you can view more information at:
Comments
Post a Comment