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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -