Mustache template
Optional
options: OptionsOptions object.
Render function
import { fromMustacheTemplate } from "@nosto/autocomplete/mustache";
const render = fromMustacheTemplate(`
<div>
<h1>{{title}}</h1>
<ul>
{{#products}}
<li>{{name}}</li>
{{/products}}
</ul>
</div>
`, {
helpers: {
toJson: function () {
return JSON.stringify(this)
}});
render(document.getElementById("container"), {
title: "My Title",
products: [
{ name: "Product 1" },
{ name: "Product 2" },
{ name: "Product 3" }
]
});
Render a Mustache template into a container