ショッピング カートの製品のテーブルをレンダリングする 2 つのバックボーンの入れ子になったビューがあります。すべてのビューには独自のアンダースコア テンプレートがあります。カートが空の場合、メイン ビューのみがレンダリングされ、空の div が「cart is empty」に置き換えられます。残念ながら、次の解決策は機能しませんでした。
<div class="container">
<div class="twelve columns">
<table class="standard-table">
<thead>
<tr>
<th>Remove</th>
<th>Product code</th>
<th>Name</th>
<th>Price</th>
<th>Quantity</th>
<th>Total</th>
</tr>
</thead>
<tbody class="cart-table-body">
<% if (typeof(product_id)=="undefined") { %>
<tr>
<td>cart is empty</td>
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
ネストされたテンプレート
<td><i class="icon-remove-sign"></i></td>
<td><%= product_id %></td>
<td><%= product_name %></td>
<td><%= price %></td>
<td><%= quantity %></td>
<td><%= price*quantity %></td>