Closed NightFox7 closed 10 years ago
Hi Aymen,
Mustache (as defined by http://mustache.github.io/mustache.5.html - go read it if your haven't yet) has no support for literals. There is no way to embed strings, numbers, booleans, etc. in templates.
Mustache also has no support for operators. There is no such thing as ==
, <
, etc.
As I stated at http://stackoverflow.com/questions/25213143/grmustache-pass-constant-values-in-filter:
There is no support for string literals in the library.
You may consider those alternate solutions:
- naming your constants: {{# isEqual(item, ThatValue) }}
- declaring template-targeted properties: {{# item.isThatValue }}
- using a template engine which supports string literals, such as handlebars-objc.
You may also enjoy the ViewModel Guide. It describes various techniques to feed templates.
Thanks @groue for your quick reply. I think I will go with the IsEqual filter
Great! Happy Mustache!
How can I render something only if if a certain variable verifies a certain condition For example