1
我想轉換此jsfiddle敲除http://jsfiddle.net/KN4P6/7/從使用選擇單選按鈕。使用選擇字段無線電輸入Knockout轉換表格
我陷入困境我相信某事與電臺值不是實際的對象,並且位置依賴綁定失敗。我嘗試的的jsfiddle是在這裏:http://jsfiddle.net/4W7PZ/
<h1>Select Package:</h1>
<div data-bind="foreach: packages" >
<div>
<input type="radio" name="optionsGroup" data-bind="attr: {value: name}, checked: $root.selectedPackage" />
<span data-bind="text: name"></span>
</div>
</div>
<h1>Select Location:</h1>
<!-- ko with : selectedPackage -->
<div data-bind="foreach: locationOptions" >
<div>
<input type="radio" name="optionsGroup" data-bind="attr: {value: location}, checked: $parent.selectedLocation" />
<span data-bind="text: location"></span>
</div>
</div>
<!-- /ko -->
<h1>Details:</h1>
<span data-bind="with: selectedPackage">
<p>You have chosen <b data-bind="text: name"></b> (<span data-bind="text: description">)</span></p>
<!-- ko with : $parent.selectedLocation -->
In location <b data-bind="text: location"></b>
<p>Total is <b data-bind="text: price"></b></p>
<!-- /ko -->
</span>