Step-1:
IN manifest.json
in node "sap.ui5"-> "models":{}
Add custom model name after i18n
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "chg.i18n.i18n"
}
},
"": {
"dataSource": "mainService",
"preload": true
},
"op":{
"type": "sap.ui.model.odata.JSONModel"
}
},
Step 2:
In Component.js
Create model and add dummy data to model
var oData = {
recipient : {
name : "World"
}
};
var oModel = new sap.ui..model.json.JSONModel(oData);
this.setModel(oModel,'op');
Step3:
In any controller u can use this model and get / store data.
in main.controller.js
var data = this.getView().getModel('op').getData();
No comments:
Post a Comment