I am having a problem with the new anonymous template engine. It cannot use nested templates. I get the error: "This template engine does not support anonymous templates nested within its templates".
My question: how do I force knockoutJS to use the jquery templates engine and not the new one. (until it also supports nested templates off course)
Thank you
Kindest regards Jan
A couple things that should help clear this up:
foreach
, if
, ifnot
, and with
within it. You can still use the template binding (including nested templates).ko.setTemplateEngine()
. You would pass an instance of the engine that you want to use like ko.setTemplateEngine(new ko.nativeTemplateEngine)
templateEngine
parameter.So, for your case, you would likely want to remove the reference to jquery.tmpl.js, so that the native template engine is being used by default. The native template engine does support nested templates (anonymous or named).
Quick sample showing a named template with anonymous templates inside of it using the native template engine: http://jsfiddle.net/rniemeyer/GXFYB/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With