I want to display several URLs in table and put a remove button next to each one. Since this is used on several places I decided to use knockout templating.
<script type="text/html" id="new-repo-template">
<tr class="row">
<td class="url-cell"
data-bind="text: repo.url"></td>
<td class="button-cell">
<button data-bind="click: removeUrl">X</button>
</td>
</tr>
</script>
<table>
<tbody data-bind="template: {name: 'new-repo-template',
foreach: myDataCollection, as: 'repo',
data: {removeUrl: myFunctions.removeRepo } }">
</tbody>
</table>
Problem is that I need to combine foreach where I want to provide data and function call which is stored in myFunction object which is not part of myDataCollection.
Is it possible to combine this foreach with collection data and data object where is static and common properties for all collection objects?
Current setup where I have foreach next to data binding causes that data is not set and the property removeUrl is unknown.