javascript - Can HTMLbars be used without Ember.js? -
i've been looking while now, , every time htmlbars mentioned ember involved. problem want migrate handlebars htmlbars, project has custom framework. if htmlbars make content returned html elements, rather string, why ember exclusive, , has found way work around exclusivity.
yes, can used without ember.js, can analyze code in demos or can dig tests in htmlbars repository.
the interesting fragment of code is:
var template = compiler.template(templatespec); var env = { dom: new domhelper(), hooks: hooks, helpers: {} }; var scope = hooks.createfreshscope(); hooks.bindself(env, scope, data); var dom = render(template, env, scope, { contextualelement: output }).fragment; output.innerhtml += '<hr><pre><code>' + json.stringify(data) + '</code></pre><hr>'; output.appendchild(dom);
Comments
Post a Comment