meteor - Route data not accessible in template -
i have problem accessing data route.
router
router.route('/view/:_id', { name: 'locationview', data: function() { return locations.findone(this.params._id); } }); locations mongodb collection i've subscribed to. can access via helper method on template without problems. has objects name, address etc.
template
<template name="locationview"> <h1>{{name}}</h1> </template> demo
application hosted on meteor.com
on front-page can see entries locations accessible other templates on helper methods. why can't access them via data object route?
solution
the problem adding objects via mongo shell. caused objectid(xxx) stuff appear in _id of object.
i've added test objects via collection method 'insert' , works fine!
i tried application , saw url:
http://mhaehnel-compass.meteor.com/view/objectid(%22554e58c15eb2cd41fc085c0e%22)
the objectid() part mongodb , not supposed in url.. that's why meteor not doing thing expected. example how set link locationview route
{{pathfor 'locationview' _id = this._id}}
hope helps
Comments
Post a Comment