0
SAPUI5檢查模型屬性我重視我的看法模型:鑑於
控制器代碼:
var model =
{
title:"Scan RFID container",
question:"Please scan the RFID tag on the container",
answer:"",
type:"input",
options:"",
transaction : ""
};
var oQuestion = new sap.ui.model.json.JSONModel();
oQuestion.setData(model);
this.getView().setModel(oQuestion, "containerChecks");
在我看來,我可以通過使用大括號設置文本等。這當然只適用於解析這些內容的sapui5元素。
查看代碼
this.page = new sap.m.Page({
title: "{containerChecks>/title}",
content: [
new sap.m.Text({
text: "{containerChecks>/question}"
})
],
});
不過,我想根據我的模型屬性'options'
做了檢查。
我想:
var options = this.getModel("containerChecks").getProperty("options");
但getModel
回報null
最後一行'VAR選項= this.getModel ...',在那裏它到底放在哪裏?視圖內部,內部函數內部還是控制器內部? – Qualiture
@Qualiture着createContent – Hazaart
認爲如果是直接在createContent中您的視圖()方法中,然後this.getModel(「containerChecks」)不應該返回null ......您可以發佈JSBin例子嗎? – Qualiture