次のようにデータが存在しない場合は、テーブルを非表示にできることを知っています: visible: Vehicles().length>0
<table data-bind="visible: Vehicles().length>0">
<thead><tr><th>Brand</th><th>Model</th><th>Registration</th><th></th></tr></thead>
<tbody data-bind="foreach: Vehicles">
<tr data-bind="click: $root.goToVehicle">
<td data-bind="text: Brand"></td>
<td data-bind="text: Model"></td>
</tr>
</tbody>
</table>
車両は観察可能なオブジェクトです。
今、私は別のシナリオを持っています:
<table data-bind="with: chosenCategoryData">
<thead><tr><th>Brand</th><th>Model</th><th>Registration</th><th></th></tr></thead>
<tbody data-bind="foreach: Vehicles">
<tr data-bind="click: $root.goToVehicle">
<td data-bind="text: Brand"></td>
<td data-bind="text: Model"></td>
</tr>
</tbody>
</table>
ご覧のとおり、html テーブルに入力するデータを含む Vehicles オブジェクトは、chooseCategoryData という名前の別のオブジェクト (観察可能) に含まれています。
でテーブルを非表示にしようとしましvisible: Vehicles().length>0
たが、Vehicles が観測できないためか、エラーが発生しました。
どうすれば続行できますか?