I have a Meteor template that uses a dynamic subscription:
var templateId = event.target.value;
Meteor.subscribe('orderTemplateShow', templateId)
templateId
changes depending on the select value I choose:
<p><label>Select Template</label></p>
<select id="templateSelect" name="templateSelect">
<option disabled selected> Select Template </option>
{{#each orderTemplates}}
<option value="{{this._id}}">{{this.templateName}}</option>
{{/each}}
</select>
Once I select a template, the template's information renders on a table that I have on the template.
My table:
<table id="templateItems" class="table">
<thead>
<tr>
<th>Product Code</th>
<th>Brand</th>
<th>Description</th>
<th>Member Price</th>
<th>Quantity</th>
<th></th>
</tr>
</thead>
<tbody>
{{#each templateItems}}
<tr>
<td>{{productCode}}</td>
<td>{{brand}}</td>
<td>{{description}}</td>
<td>${{memPrice}}</td>
<td><input type="text" id="qty" value ="{{quantity}}"></td>
<td><button class="btn btn-primary removeCartItem">Remove</button></td>
</tr>
{{/each}}
</tbody>
</table>
</form>
However, when I click on a new template, data from the old template still appears on the table, in addition to data from the new template that I select. Therefore, is there a way for me to dynamically remove data from an old subscription?
Thanks!