cancel
Showing results for 
Search instead for 
Did you mean: 

Setting a JSON value in a JavaScript Variable

Former Member
0 Kudos

Hi fórum...

I have a SAP UI5 XML View and a JSON Model, the view show the value in a text component:

<Text xmlns="sap.m" id="iduser" text="{userapi>/displayName}"></text>

That´s correct, and show the value in the App,,,, "But i want to setting the value in a JavaScript Variable.... for use it  in another thing.. i don´t know how to do it...  "


I call the JsonModel from the index.html... and i want the variable there.


!!

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

var __displayName__  = this.getView().getModel("userapi").getData().displayName

former_member182862
Active Contributor
0 Kudos

or

var displayName = this.getView().getModel('userapi').getProperty('/displayName');

Thanks

-D