Combining and nesting templating functions
With all functions that take parameters the convention is as follows:
String literal parameters and number literal parameters are enclosed in single quotes.
When calling a function from within a function the inner function should be enclosed in parenthesis not handlebars.
When using variables and arrays, their names are string based parameters and are normally enclosed in single quotes, unless they are the result of a nested function (this can be useful)
Boolean flag parameters are not enclosed in single quotes.
Iterator instance parameters (this, or this.<<some-variable>>) are not enclosed in single quotes
Function names are not enclosed in single quotes.
Examples:
Many functions can be nested inside other functions. In some cases it makes sense to nest multiple levels of functions. It is conventional to enclose the inner functions with round brackets instead of handlebars.
Example 1:
Consider the following 3 functions:
As an example they can be combined together in the following way:
Example 2:
Consider the following 3 functions:
As an example they can be combined together in the following way:
Last updated