Template Engines Supported

Client Side Templatates and the ClientBlockRepeater use the native knockout client side template engines, however they supports also the jQuery template engines whose js file is included in the binary distribution of the Mvc Controls Toolkit, and the Underscore template engine that can be downloaded here. All client side control flow statements (_foreach, _if, _ifnot, and _with) always use the knockout native template engine.

Normally the default template engine used by all client side bindings and helpers is the native knockout engine, that allow just the use of knockout bindings in the templates, and doesn't allow any string substitution. Normally this is enough for most of the applications. However, if you would like to use the string substitution capabilities of either the jQuery template engine or the Underscore template engine, it is enough to put a javascript reference to it just before the reference to the knockout.all-x.x.x.min.js, and the relative template engine will be automatically used as default template engine. If you include a reference to both the jQuery and the Underscore template engines, the Underscore template engine will be taken as default engine.

In order to use a template engine that is different from the default engine in a specific statement you can pass one of the strings below as value of the optional templateEngine parameter:

  • jqueryTmplTemplateEngineExt, to select the jQuery Template Engine.
  • underscoreTemplateEngineExt to select the Underscore template engine
  • nativeTemplateEngine to select the native template engine

 

 

 

Last edited Jun 22, 2014 at 10:46 AM by frankabbruzzese, version 2

Comments

No comments yet.