Skip to content

Latest commit

 

History

History
85 lines (84 loc) · 3.5 KB

File metadata and controls

85 lines (84 loc) · 3.5 KB

Custom Block Helpers

These helpers all return an updated context and pass that context into a nested template. These also all support an else condition in the case where the operation either failed or returned false.


Context

{
  "value": "something wicked this way comes"
}

Example 1: Showing conditional if/else style logic

<div>
  {{#Helpers.String.Contains value "this"}}
      <strong>True</strong>
  {{else}}
      <strong>False</strong>
  {{/Helpers.String.Contains}}
</div>

would return

<div>
  <strong>True</strong>
</div>

Example 2: Showing how context gets passed around

<ul>
  {{#Helpers.String.Split value " "}}
      {{#each this}}
          <li>{{this}}</li>
      {{/each}}
  {{else}}
      <li>NOTHING FOUND</li>
  {{/Helpers.String.Split}}
</ul>

would return

<ul>
    <li>something</li>
    <li>wicked</li>
    <li>this</li>
    <li>way</li>
    <li>comes</li>
</ul>