Is there a way (except using eval()
) to build a sapui5 control if the constructor is a string?
For example, I want to build a text control:
var oText = new sap.m.Text({});
but the part "new sap.m.Text({})
" is actually a string.
I tried eval()
:
var sObj = "new sap.m.Text({});";
var oObj = eval(sObj);
oObj.setText("Hello");
and it works.
The question is if there is another, more secure way to do it.