What is difference between ":" and ">" characters for printing the data in JsRender template?

StackOverflow https://stackoverflow.com/questions/19159622

  •  30-06-2022
  •  | 
  •  

Question

What is difference between ":" and ">" characters for printing the data in JsRender template?

<div>{{:Name}}</div>

VS

<div>{{>Name}}</div>

I would appreciate for your help.

Thanks in advance.

Was it helpful?

Solution 2

According to the documentation:

{{:Name}} Evaluates the data-path or expression

{{>Name}} Gets the HTML-encoded value of the data path or expression, and inserts it into the rendered output

When JSON data is:

{Name: "Boris <b>Moore</b>"}

results are:

  • {{:Name}} returns: Boris Moore

  • {{>Name}} returns: Boris <b>Moore</b>

OTHER TIPS

The documentation is here:

http://www.jsviews.com/#jsrtags

http://www.jsviews.com/#assigntag

http://www.jsviews.com/#htmltag

And there is a sample here: http://www.jsviews.com/#samples/jsr/converters.

And this sample covers both JsRender and JsViews converters, including 2-way converters, but also refers to the HTML encoding converter used in {{> ...}}:

http://www.jsviews.com/#samples/form-els/converters

It's worth exploring the rest of the documentation too. It should make it a lot easier to figure things out!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top