这是非常愚蠢的问题,但我不知道它为什么会发生.我在控制器中发现了这个:
this.getView().setModel(this.placesModel, "myCity");
Run Code Online (Sandbox Code Playgroud)
然后我用Ajax请求将数据设置到我的快速RESTFull应用程序和View.xml中
<List items="{path: 'myCity>/people'}">
<CustomListItem>
<VBox>
<Title text="Person:"/>
<Label text="{myCity>/people/name}"/>
<Label text="{myCity>/people/age}"/>
</VBox>
</CustomListItem>
</List>
Run Code Online (Sandbox Code Playgroud)
我有myCity几个属性的对象.其中一个是对象people,它是一组对象.当我尝试列出这些时,我可以看到我的所有人都被列出但没有相应的姓名和年龄.此外,我发现很难>在/何时何时使用>/.
小智 5
{(model_name)>(path_to_property)}如果您没有模型名称(默认模型),则只需指定模型名称的基本绑定语法{path_to_property}.
如果你没有,则需要初始斜杠(/)contextbinding.在您的情况下,您已contextbinding在List上设置,因此您不需要使用斜杠.
更新的代码:
<List items="{path: 'myCity>/people'}">
<CustomListItem>
<VBox>
<Title text="Person:"/>
<Label text="{myCity>name}"/>
<Label text="{myCity>age}"/>
</VBox>
</CustomListItem>
</List>
Run Code Online (Sandbox Code Playgroud)
有关更多信息,请参阅绑定路径.
| 归档时间: |
|
| 查看次数: |
49 次 |
| 最近记录: |