HTML Helper

Helper Description
classIf Set the CSS classes if the condition is true.
selectedIf Sets the selected attribute if the condition is true.
checkedIf Sets the checked attribute if the condition is true.
options Generates a select drop-down option list.

classIf

Set the CSS classes if the condition is true.
Parameters:
  • expression: boolean
    Condition to be checked.
  • clazz: string
    CSS class to set if the condition is true.
          // results in: foo
hbs.compile("{{classIf expression 'foo'}}")({"expression":true});
        

selectedIf

Sets the selected attribute if the condition is true.
Parameters:
  • expression: boolean
    Condition to be checked.
          // results in: selected
hbs.compile("{{selectedIf expression}}")({"expression":true});
        

checkedIf

Sets the checked attribute if the condition is true.
Parameters:
  • expression: boolean
    Condition to be checked.
          // results in: checked
hbs.compile("{{checkedIf expression}}")({"expression":true});
        

options

Generates a select drop-down option list.
Parameters:
  • data: {[key: string]: string}[]
    List of data.
  • options: {value: string, text: string}
    Key names for the selected and displayed values of option in the data element (Optional).
          // results in:
// <option value="1">foo</option>
// <option value="2" selected>bar</option>
hbs.compile("{{{options data selected='2'}}}")({"data":[{"value":1,"text":"foo"},{"value":2,"text":"bar"}]});

// results in:
// <option value="392" selected>JAPAN</option>
// <option value="840">UNITED STATES</option>
hbs.compile("{{{options data selected='392' value='code' text='name'}}}")({"data":[{"code":392,"name":"JAPAN"},{"code":840,"name":"UNITED STATES"}]});