How do I specify options params in Handlebars.java?

Viewed 650
1 Answers

Found my own answer. Options are specified in the template, not in the input data. Any params passed to a helper function, after the context argument, will be options. For example:

Template:

{{yourHelperFunction context "option1" "option2"}}

Input data:

{ 

    "someData" :"data" 

} 

Java code:


    public yourHelperFunction(String context, Option options){
        if (options.param(0) == "option1") /*do something */
    }

Related