0
votes

In UI5 documentation it is written:

// set data model
const oData = {
    recipient: {
        name: "World"
    }
};

But there is no any addressing regarding:

  • What does it mean World in this context.
  • What value should/can we use here?
  • Should we specify recipient: {name: "World"} here at all or the only thing we need to do here is to initialize new JSONModel(oData)?
1

1 Answers

1
votes
  1. the following code is only a normal JavaScript object, not model.
const oData = {
    recipient: {
        name: "World"
    }
};

2.the following code initialize a model.

var oModel = new JSONModel(oData);

After this initialization, you can get/set any properties of this model

var oRecipient = oModel.getProperty("/recipient");
var sName = oModel.getProperty("/recipient/name");

oModel.setProperty("/recipient",{"name":"abc"});
oModel.setProperty("/recipient/name","abc");