0

我有 2 个模型 - 消息和用户 - 每条消息都有一个用户。我正在加载一个包含嵌套用户数据的 json 消息文件——我的模型已经定义了它们的关系。

[{"message_id":"1","user":{"user_id":"2","name":"Bob"},"text":"This is a sample message that is here as a placeholder until we have real comments"}...

在我的模板中,我想访问用户数据 - 但 {user.name} 不会产生任何东西。

有人有例子吗?看来我必须自己解析这个但不知道从哪里开始

4

1 回答 1

0

Try to use <tpl for="user">{name}</tpl> to display the nested data.

于 2012-04-26T09:20:29.217 回答