I am using jsRender to display my data on an html page. The data is getting great. However, in some content elements, HTML text (such as a hyperlink) appears as text. There is a way in the jquery template to render HTML using {{html. Is there something similar in jsRender? My code is as follows:
<p> {{ =Status}} //need to convert this to HTML so it should appear as hyperlink. </p>
Thank.
JsRender beta candidate is now missing (see Boris post from last night http://www.borismoore.com/2012/03/approaching-beta-whats-changing-in_06.html )
I wrote a quick script to show how to render HTML here: http://jsfiddle.net/johnpapa/NfUGB/
, {{ > yourProperty}} HTML-. {{: yourProperty}}, .
<script id="template" type="text/x-jsrender"> <p> {{:foo}} </p> <ul> {{for testData}} <li>{{:name}} - {{:markup}} - {{>markup}}</li> {{/for}} </ul> </script> <div id="div1"></div>
.
var vm = { foo: "names", testData: [ { name: "John", markup: "<span style='background: yellow'>John</span>" }, { name: "Boris", markup: "<span style='background: orange'>Boris</span>" } ] }; $("#div1").html($("#template").render(vm));
{{:Status}} HTML-.
{{:Status}}
jsRender, , <, > HTML-. , jsRender
escapeMapForHtml = { "&": "&", "<": "<", ">": ">" },
escapeMapForHtml = { },
HTML !
EDIT: , (, 03_no-encoding.html) . ,
{{=Status!}
jsRender HTML
..
<p> {^{ =Status}} </p>