Reputation: 52922
atm I have something like this:
$('#fish').append("<div data-bind='foreach: rows'>" +
"<div ..." +
"<p>...</p>"..);
and I don't want nasty inline templates, so I put the template into a <script id='fishtemplate' type='text/html'></script>
I want to append(fishtemplate)
, is this possible?
Upvotes: 0
Views: 91
Reputation: 3921
Try to use:
<div data-bind="template: { name: 'fishtemplate', foreach: row }"></div>
See http://knockoutjs.com/documentation/template-binding.html (section Note 2: Using the “foreach” option with a named template)
Upvotes: 1