Articles in this section

root helper

Reference the @root data variable to access the root element properties while you iterate in the context of any nested or child elements. The following scenarios illustrate @root with sample JSON.

Template

Context

Output

{{@root.title}}
{
  "title": "My New Post",
  "body": "This is my first post!",
  "array": [1,2,3,4],
  "message": "This is the message."
}
My New Post
{{#each array}}{{@root.title}}
{{/each}}
{
  "title": "My New Post",
  "body": "This is my first post!",
  "array": [1,2,3,4],
  "message": "This is the message."
}
My New Post
My New Post
My New Post
My New Post
 {{@root.child.childTitle}}
{
  "title": "My New Post",
  "body": "This is my first post!",
  "array": [1,2,3,4],
  "message": "This is the message.",
  "child": {
    "childTitle": "Child Title",
    "childBody": "Child Body"
  }
}
Child Title