-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pasing argument to partial template (#def) ? #34
Comments
There is no parameter passing right now for defines. There are 2 other ways to get this kind of functionality though.
and then instead of {{#def.row}} call {{ row(s); }} For recursion you can do this: {{ function children(it) { }}
{{?it.Nodes && it.Nodes.length}}
<ul>
{{~ it.Nodes :p}}
<li>
{{=p.title}}
{{children(p);}}
</li>
{{~}}
</ul>
{{?}}
{{ } }}
{{ children(it); }} |
Hey THANKS!.. I ended up with a solution like you describe in "1." yesterday, where the reused template was also stored else where as it's own template though. But I think I like the idea of using a function better, so ill try to get that into place. /Jeme |
Thanks Tomasz. I will push support for passing arguments to defines very soon. On 2012-12-17, at 5:39 AM, tomasz stryjewski wrote:
|
In the advanced examples you define a snippet like:
I was wondering if it was at all possible to substitute "it" for that snippet.
Given the following example:
Now the idea would be to print "p.Title" for the first level and then "s.Title" for the second level, but re-use the same template for both elements...
Also would it be possible to make the above recursive somehow?
The text was updated successfully, but these errors were encountered: