Nyxynyx
Nyxynyx

Reputation: 63599

Pass Iron Router params to pathFor Helper

When using a pathFor template helper, how can we pass Router.current().params._id into it?

The following code

<a href="{{ pathFor 'myPage' _id=Router.current().params._id }}">

gives an error

Expected space ...e' _id=Router.current().params._id }}" cl...
                                       ^`

Upvotes: 1

Views: 242

Answers (1)

Peppe L-G
Peppe L-G

Reputation: 8345

Use Router.current.params._id instead of Router.current().params._id. Meteor will dynamically check the property values, and if it comes across a function, it will call it.

Upvotes: 1

Related Questions