Problem is to print out the current year by using expression binding that was introduced with 1.28.
Expression Binding is capable of executing global accessible JS Functions.
Goal: Execute (new Date()).getFullYear() in expression binding
window.temp = function() {return 'test'}; and to execute it via <Text text="{:=temp()}" /> => fail<Input value="{:=(new Date()).getFullYear()}" /> breaks parser and is in jsfiddle therefor outcommented.
The Error Message is Expected ) but instead saw Date at position 9 - {:=(new Date()).getFullYear()} sap.ui.base.ExpressionParserFirst question is: Why does the parser break? Is it a bug or am I doing something wrong?
Second question is: Even if the goal is not possible. Why is my second attempt also not working?
I assume that the parser breaks as it does not support the new operator. Your second example is not working as only functions which are available via global symbols can be used. The window object is not listed there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With