Skip to content

template.context

Populates the template variables with data.

js
template.context(data)

Parameters

  • data - an object containing template variables to use in a template.

Example

html
<script runat="server">
    let data = { name: 'Brad' };
    template.context(data);
</script>
<div>
    <h1>Hello, {{name}}!</h1>
</div>