Knockout renderTemplate() rendering modes
Asked Answered
T

2

9

I'm trying to call ko.renderTemplate() in a custom binding.

However I can't find any documentation for it's usage, particularly the rendering mode parameter.

Knockout.js pro tips – working with templates

The site above has a section "You can render templates directly from your custom bindings" that briefly describes the parameters to renderTemplate().

What are the other available options for the rendering mode parameter?

Additionally, is there any documentation for renderTemplate() and the rendering engine options that I may have missed?

Triacid answered 6/11, 2012 at 13:53 Comment(0)
P
10

Just from looking at the source code of 2.2.0.

The renderMode parameter seems to have two options:

  • replaceNode - This will replace the entire target node with the output of the template.
  • replaceChildren - Default. This will replace only the children of the target node, leaving the target node intact.
Pathe answered 6/11, 2012 at 14:2 Comment(1)
+1 There is still not enough documentation in the website of Knockout for this useful feature. Ohhhh sorry, there is absolutely no documentation about that :) Thank you very much!Recife
P
8

You can find ko.renderTemplate() explained pretty well with some examples in this article.

Providence answered 3/2, 2013 at 23:5 Comment(1)
It is a good article but the template isn't fleshed out enough to get a full understanding and the rest of the code is hidden behind a "spam wall".Bihari

© 2022 - 2024 — McMap. All rights reserved.