Knockout renderTemplate() rendering modes

2019-03-26 20:48发布

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?

2条回答
疯言疯语
2楼-- · 2019-03-26 21:34

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

查看更多
聊天终结者
3楼-- · 2019-03-26 21:45

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.
查看更多
登录 后发表回答