Renders a TemplateResult
to a container using an
ExtendedTemplateInstance
, which allows templates to set properties and
event handlers.
Properties are set by default, instead of attributes. Attribute names in lit-html templates preserve case, so properties are case sensitive. If an expression takes up an entire attribute value, then the property is set to that value. If an expression is interpolated with a string or other expressions then the property is set to the string result of the interpolation.
To set an attribute instead of a property, append a $
suffix to the
attribute name.
Example:
html`<button class$="primary">Buy Now</button>`
To set an event handler, prefix the attribute name with on-
and use a
function to return the handler, so that the event handler itself is not
called as a template directive.
Example:
html`<button on-click=${_=> this.onClickHandler}>Buy Now</button>`
Generated using TypeDoc