Skip to content

Instantly share code, notes, and snippets.

@HenderOrlando
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save HenderOrlando/9398947 to your computer and use it in GitHub Desktop.

Select an option

Save HenderOrlando/9398947 to your computer and use it in GitHub Desktop.
En el ejemplo vemos que la plantilla llamada "TemplateName" recibe un arreglo llamado "dato". Tener en cuenta que la plantilla llamada "templateName" debe pasarse como variable, es decir, sin comillas, como lo estamos viendo.
var output = Twig.render(templateName, {
dato: [
{
url : 'url/from/js',
class : 'class-js',
attrs : 'attrs=""',
heading : 'JS Loaded',
text : 'Plantilla cargada desde JS',
badge : {
url : 'url/Badge',
class : 'class',
attrs : 'attrs=""',
text : 'texto',
},
}
]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment