SAPUI5 allows for the use of Expression binding 'in-line' to execute code (for example, to do certain calculations or comparisons) in places where one would normally use a variable, or call a custom function.
For example, on the screen below we want to display/hide the contents of the text control, depending on the value in the input field:
You could:
- Define a Boolean variable in the data model (called 'visible', or something similar).
- Assign this variable to the 'Visible' property in the Properties of the text field.
- Write JavaScript to set the 'visible' field to true or false, depending on the value in the 'Value' input field.
OR, you could:
- Use expression binding, accessing the value directly to set the "visible" property of the text control.
Example:
visible="{=${/value} > 10000 }"
(where 'value' is the data model field bound to the Value input field)
You can find more complex examples in the SAP documentation at: Expression Binding