Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JsRender - How to render template from within template?

How can I render a template from within a template in JSRender? In the previous jquery template, I could use

{{tmpl(Languages) "#languageTemplate"}}

In JSRender, I could find template composition examples in conditional statements and loops. I want to call the template independently.

like image 367
Joyce Babu Avatar asked Feb 20 '23 12:02

Joyce Babu


1 Answers

In JsRender

{{for Languages tmpl="#languageTemplate"/}}

is more or less exactly equivalent to the following in jQuery Templates

{{tmpl(Languages) "#languageTemplate"}}

In each case if Languages is an array, the languageTemplate will render once for each item, but if Languages is not an array, the template will render once.

like image 123
BorisMoore Avatar answered Mar 03 '23 03:03

BorisMoore