mustache
can.view.mustache
can.view.mustache( [id,] template )
Register a Mustache template string and create a renderer function.
var renderer = can.view.mustache("<h1>{{message}}</h1>");
renderer({message: "Hello"}) //-> docFrag[ <h1>Hello</h1> ]
Parameters
-
id
{String}
OptionalAn optional ID for the template.
can.view.ejs("greet","<h1>{{message}}</h1>"); can.view("greet",{message: "Hello"}) //-> docFrag[<h1>Hello</h1>]
-
template
{String}
A Mustache template in string form.
Returns
{renderer(data, helpers)}
A renderer function that takes data and helpers.
can.view.mustache([id,] template)
registers an Mustache template string for a given id programatically. The following registersmyStache
and renders it into a documentFragment.To convert the template into a render function, just pass the template. Call the render function with the data you want to pass to the template and it returns the documentFragment.