I have a page that requires jQuery.tmpl, but I want to use native knockout templating for a
data-bind="foreach: Comments"
attribute. Because I have included jQuery.tmpl, knockout’s native templating is disabled; is there a way that I can force the native functionality?
Thanks
You cannot use
foreachor other control-flow bindings within a jQuery.tmpl template.However, if you want to call a named template and force it to use the native template engine, then you would do something like:
or cache a copy of a native template engine (
new ko.nativeTemplateEngine()) in a variable.