Im trying to implement an user update page in my Meteor app. My router.js
:
Router.route('/company/:_id/update/', {
name: 'CompanyUpdate',
data: function() { return Meteor.users.findOne(this.params._id);}
});
The URL I use is (ignore the polymer tags):
<paper-icon-button icon="perm-identity" onclick="location.href='{{pathFor 'CompanyUpdate' _id=userId}}'"></paper-icon-button>
When that URL is clicked, I get: http://localhost:3000/company/null/update
. It takes me to the page but I cant get no information from the user's database. Not sure why I get a "null" in the url.
I am still learning meteor and would like someone to explain what is missing or doing wrong.
userId
in your template in null. Try using the default {{currentUser}}
template which calls Meteor.user()
. So something like this should work:
<paper-icon-button icon="perm-identity" onclick="location.href='{{pathFor 'CompanyUpdate' _id=currentUser._id}}'"></paper-icon-button>