Reputation: 297
I have created a JSON data & saved in webapp/json/TableData.json & in manifest.json, I have added following code : -
"BPCdata" : {
"type": "sap.ui.model.json.JSONModel",
"uri": "json/TableData.json"
},
How can I get this model in a controller?.
Upvotes: 0
Views: 3999
Reputation: 297
I have got the model with the following code. It works !!. Thanks for the responses.
var bpcCollect = this.getOwnerComponent().getModel("BPCdata").getProperty("/BPC");
Upvotes: 0
Reputation: 1742
Pass name of the model to be obtained as argument to getModel()
this.getView().getModel("BPCdata");
Upvotes: 1
Reputation: 747
try using sap.ui.getCore().getModel()
Reference : https://sapui5.hana.ondemand.com/#docs/api/symbols/sap.ui.model.Context.html#getModel
Upvotes: 0