Reputation: 1391
Does anyone know if it's possible to use expression binding within javascript for example with the bindProperty method?
I would like to be able to use it like this:
new sap.m.Text().bindProperty("text", "= !${myModel>PropertyBoolean}")
All I found from SAP is the documentation for XML Views: help.sap.com
Upvotes: 1
Views: 2816
Reputation: 36
I know this is a very old question, but yes, you can use expression binding in a JS controller and I just leave it here, maybe someone will find it helpful.
const myButton = new sap.m.Button({
text: "{= ${someModel>/isMorning} ? 'Good Morning' : 'You're late' }"
})
This should look similar with bindProperty.
Upvotes: 1
Reputation: 4920
Expression binding was introduced for XMLViews to allow for some rudimentary coding (which is not possible with XML)
In Javascript, this isn't needed of course. In your example, you could simply use a formatter function:
new sap.m.Text().bindProperty("text", "myModel>PropertyBoolean", function(bValue) {
return !bValue;
});
Upvotes: 3