This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Call your template recursively
Compiled templates can be included within each other.
This example show a specific example when the template is calling itself, triggering a recursion.
The HTML:
<ul class="treeItem">
<li class="children"><a class="name" href="#">name</a></li>
</ul>
The JSON data:
var context = {
children: [{
name:'Europe',
children:[{
name:'Belgium',
children:[{
name:'Brussels'},{
name:'Namur'},{
name:'Antwerpen'}]},{
name:'Germany'},{
name:'UK'}
]},{
name:'America',
children:[{
name:'US',
children:[{
name:'Alabama'},{
name:'Georgia'}
]},{
name:'Canada'},{
name:'Argentina'}]},{
name:'Asia'},{
name:'Africa'},{
name:'Antartica'}]};
The Javascript to do this action (here with jQuery):
var directive = {
'li+':function(arg){
if(arg.item.children){
return $p.compiledFunctions.tree.compiled(arg.item);}}};
$('ul.treeItem').compile('tree', directive, context);
$('ul.treeItem').render(context, 'tree');
Note:
Each time an html is compiled, it is stored at $p.compiledFunctions[templateName].compiled






