public
Created

Compilação do template

  • Download Gist
compile.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
jsonTemplate = {
"Widgets": {
Modal: {
head: {
title: "Teste de Modal"
},
body: "Teste do corpo"
},
Buttons: [
{
name: "Butao", css: "teste", text: "Salvar"
},
{
name: "Butao", css: "teste", text: "Editar"
}
]
}
};
var config = {
url: "tmpl.modal.html", sprite: "Widgets.Modal"
}
$.compileTemplates(config);
render.js
JavaScript
1 2 3 4 5
var config = {
url: "tmpl.modal.html", sprite: "Widgets.Modal", json: jsonTemplate
}
var $modal = $("< div >").render(jsonTemplate, "Widgets.Modal");
$(document.body).append($modal);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.