Emberjs:内部循环中的数据绑定中断

时间:2014-11-18 20:26:52

标签: ember.js handlebars.js

我的模型中的数据没有受到限制。第一个循环中的类别绑定正常。如果我对输入框进行了更改,我的模型会反映出这种变化。

问题似乎出现在内部的每个循环中。内循环中的所有更改都不会反映在模型中。如果我将内部循环更改为{{#each instructions}}并使用{{this}}而不是{{description}},我的模型仍然无法反映更改。

{{#each amenities}}
{{input type="text" value=category}}
<div><label>{{category}}</label></div>
<ul class="sortable-amenities" style="list-style-type: none;">
{{#each description in descriptions}}
    <li>
        <div>
            <span class="handle glyphicon glyphicon-move pull-left" style="margin-top: 15px; margin-right: 10px;"></span>
            {{input type="text" class="form-control input-amenities" name="amenity-description" placeholder="Amenity" value=description}}
            <button style="padding-top: 3px;" {{action 'removeAmenity' description}}><span class="glyphicon glyphicon-remove" style=""></span></button>
        </div>
    </li>
{{/each}}
</ul>

{{/每}}

我想尝试循环的样本“设施”:

"amenities": [ { "category": "Featured", "_id": "53dc0aeede4be108724ce46a", "descriptions": [ "Floor Plans", "Pool", "Fitness Centre", "Air Conditioning", "Care Centre", "Pets" ] }, { "category": "Extra Features", "_id": "53dc0aeede4be108724ce469", "descriptions": [ "Three places", "Connections", "Appliances", "Breakfast", "Bright rooms", "Marble Flooring", "Ponds", "All Windows", "Organizers" ] }, { "category": "Community", "_id": "53dc0aeede4be108724ce468", "descriptions": [ "Picnic", "Basketball", "Volleyball", "Playground", "School", "Maintenance", "Customer", "Business" ] } ]

0 个答案:

没有答案