Can we use parameters in partials?

166 views
Skip to first unread message

Vikash Tiwari

unread,
Nov 25, 2019, 5:42:15 AM11/25/19
to mustache.java
I think it may be an anti-pattern and is not possible in current (https://github.com/spullara/mustache.java).
What I'd like to is
[[> partials/heading.html?case=1]]

I want to use a partial that is almost the same for >10 cases but with 2 parameters being different.

I would like to make it re-usable somehow, And this information purely concern template only, I will not be getting this in binding data.
I can think of 2 options:
- Is it possible to create scoped variables withing mustache template? (that I can use just like the other variables)
- Or maybe I could pass some praameters in partials (call)

Sam Pullara

unread,
Nov 27, 2019, 3:49:14 AM11/27/19
to mustac...@googlegroups.com
You shouldn't do any business logic like this in the template.If you want to extend mustache.java to support this all the hooks are there. I'd be happy to understand the problem you are trying to solve and show you how to do it in a way that doesn't push you to put this in the template though if you want to share more information about this use case.

--
You received this message because you are subscribed to the Google Groups "mustache.java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mustachejava...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mustachejava/c0322c71-905d-404a-bd89-13f0982b4deb%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages