cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the current OData Model in JavaScript code of the App?

abelousov
Active Participant
0 Kudos

Hi,

Of course I can get the OData model in a controller java script code in such way:

____________Cut __________________

var oDataModel = new sap.ui.model.odata.ODataModel("/bydesign/sap/byd/odata/cust/v1/exchangerate/");

____________Cut __________________

but the model (URI) is already definied in the App in manifest.json file:

I would like to set oDataModel variable without mention of URI again.

Or there is probably some way to get the URI value which was mentioned in manifest.json

Is there any solution?

Thanks a lot.

Accepted Solutions (0)

Answers (2)

Answers (2)

abelousov
Active Participant
0 Kudos

Thank you Jun,

Could you please give me a bit bigger fragment?

Yet I did not understand where I should put the expression in component.js.

junwu
Active Contributor
0 Kudos

in your component.js you can access it like this.

this.getMetadata().getManifestEntry("sap.app").dataSources.mainService.uri