My dilemma is that I would like to pass multiple object properties to an iron:router route in Meteor. The reasoning is that I would like to pass it a property to name my url wi
Is the question how to pass multiple parameters to Router.go? Just put all of them in the object for the second parameter:
Router.go('itemDetails', {_id: 'foo', '_itemId': bar});
Edit:
Ok, if you want to pass arbitrary values to the url, you can use query paramters:
Router.go('itemDetails', {itemName: 'foo'}, {query: 'id=bar'});
The id will still be in the url though, it will look like this:
http://example.com/items/foo?id=bar
And you can retrieve it like this:
Router.route('/items/:itemName', {
name: 'itemDetails',
data: function(){
return {
item: Items.findOne(this.params.query.id),
itemName: this.params.itemName
};
}
);