For some reason, this doesn't work at all.
{{user_slugged username}}
The {{username}}
is a variable available to the template. However, it gives me a null / undefined value in the helper.
Here is my helper code
UI.registerHelper('user_slugged', function(username) {
... other stuff... return things.
}
The issue I am having is when I try something like this {{user_slugged 'Hello'}}
it does everything right and returns what is expected.
However, when I try {{user_slugged username}}
it doesn't seem to work even though I can easily display {{username}}
in that same line of code.
Which seems really odd, now I'm thinking the way to send parameters to handlebars helpers might have changed in Meteor 0.8.0
. If so, it'd be great if someone could point me into the right direction or give me an answer to this question.
EDIT: To clarify I am able to use {{username}}
in the same line as {{user_slugged username}}
so something like this works
<a href="{{user_slugged username}}">{{username}}</a>
username
is an object property that is available in the template and at the point where I am trying to send it in as a param to the helper.
I am not sure why this is happening (maybe there is a global helper username
?), but you should be able to fix it easily by writing
{{user_slugged ./username}}
instead of
{{user_slugged username}}
The dot always means the current data context, so there is no way that the rendering engine will get confused about it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With