Call Expression
{{ method( [EXPRESSION...] ) }}
Calls method
with zero or many arguments where each argument
is a comma separated
EXPRESSION
.
method(1,key,hashProp=hashValue,call(),helper expression)
Parameters
- EXPRESSION
{Literal Expression|KeyLookup Expression|Hash Expression|Call Expression|Helper Expression}
:An expression that will be passed as an argument to
method
.
Use
A call expression calls a function looked up in the scope followed by the helpers scope. It looks like:
<!-- Template -->
<h1>{{pluralize(type,ages.length)}}</h1>
/* Data */
{
pluralize: function(type, count){
return type+(count === 1 ? "" : "s")
},
todos: new List([22,32,42]),
type: "age"
}
<!-- Result -->
<h1>Ages</h1>
Call expression arguments are comma (,) separated. If a Hash Expression is an argument, an object with the hash properties and values will be passed. For example:
<!-- Template -->
<h1>{{pluralize(word=type count=ages.length)}}</h1>
/* Data */
{
pluralize: function(options){
return options.word+(options.count === 1 ? "" : "s")
},
todos: new List([22,32,42]),
type: "age"
}
<!-- Result -->
<h1>Ages</h1>