クライアントが、JSON オブジェクトからハンドルバーに渡される文字列に改行を入れたいという異常な状況があります。文字をエスケープしようとしましたが、当然のことながら DOM によってレンダリングされません。助言がありますか?
"company": "Lorem adscs ireland <br/> marketed as iuhmdsf in Europe"
var products = Data;
var theTemplateScript = $("#product-template").html();
var theTemplate = Handlebars.compile (theTemplateScript);
$("#marketed-products .products").append (theTemplate(products));
{{#items}}
<li><span class="company">{{company}}</li>
{{/items}}
上記のコードからの出力は、次のようになります。
ヨーロッパでは iuhmdsf として販売されているLorem adscs ireland