Expressions
Expressions are strings or HTML markup whose contents can be replaced with the values of an object when evaluated.

String

Use variables enclosed in brackets { } in string expressions to represent the properties of an object. The properties will be replaced with the values of the properties within the object when evaluated.
Use the string function extension eval to evaluate an expression using an object passed into the function.
1
const data = {company: "Acme", employee: "Fred" };
2
3
const str = "{employee} works for {company}".eval(data);
4
5
// Fred works at Acme
Copied!

HTML

These same expressions can be set up inside HTML markup and evaluated using the wire.ui.eval method.
The first parameter to this method is the selector for the DOM element container for the markup. The second is the data to be used to evaluate expressions in the markup.
Consider the markup below.
1
<div id="exp">
2
<span>{employee} works for</span><span>{company}</span>
3
</div>
Copied!
Use the wire.ui.eval method to evaluate the containing element exp using the data object from the previous example.
1
wire.ui.eval("#exp", data);
Copied!
Copy link
Contents
String
HTML