我试图用把手输出json数据现在一切正常,除了房间的价格,我似乎无法找到它为什么不起作用。
在句柄栏教程中几乎尝试做同样的事情
json数据:
[
{
"Id": 204448,
"Name": "Albus Hotel Amsterdam City Centre",
"ImageUrls": [],
"Volatility": 0,
"Address": "Vijzelstraat 49",
"Rooms": [
{
"Id": 0,
"Name": "Family Suite, 1 King Bed with Sofabed",
"IsRefundable": false,
"IsBreakfastIncluded": false,
"Price": 2437.02,
"Amenities": []
}
]
}
]
html:
<ul>
{{#each}}
<li>
<div class="hotel_id">{{Id}}</div>
<div class="hotel_name">{{Name}}</div>
<div class="hotel_address">{{Address}}</div>
<div class="hotel_volatility">{{Volatility}}</div>
<ul>
{{#each Rooms}}
<li>
<div class="room_id">{{Price}}</div>
</li>
{{/each}}
</ul>
</li>
{{/each}}
</ul>
输出:
204448
Albus Hotel Amsterdam City Centre
Vijzelstraat 49
0
答案 0 :(得分:1)
Ember对资本化非常严格:Nested HandlebarsJS #each helpers with EmberJS not working。您可以编写JSON后处理器或预处理器。
Ember中的命名约定:http://emberjs.com/guides/concepts/naming-conventions/