The text we put inside directive's values are called binding expressions.
In d3-view, a binding expression consists of a single JavaScript expression
but not operations. The difference between expressions and operations is akin
to the difference between a cell in an Excel spreadsheet vs. a proper JavaScript program.
Valid expression are:
"The sun" // literal
theme // An identifier (a property of a model)
dosomething() // A function
[theme, number] // Arrays of identifiers
x ? "Hi" : "goodbye" // Conditionalsand complex combinations of the above
user.groups().join(", ")
[theme, user.groups(), "Hi"]The original implementation of the expression API was taken from jsep.
Expression can be created via the javascript API:
var expression = viewExpression(<expression string>);The original expression string passed to the Expression constructor.
Evaluate an expression with data from a given model. The model
can be a [model][] instance or a vanilla object.
Same as expression.eval but does not throw an exception if evalutation fails. Instead it logs the error end returns nothing.
Array of identifiers (model properties) in the expression.