0

Is there a way to compile a handlebars template on the fly and insert it into the DOM?

Like say,

<a {{action 'callAction' items}}>Some text</a>

for now, if this is done using a {{{ }}} this renders as

<a {{action 'callAction' [object Object]>Some text</a> 

and the action will obviously not be fired. Any way to achieve what Ember does while precompile?

EDIT:

I have tried

Ember.HTMLBars.compile(<code>)

but it returns an object, but not sure how to determine the template out from it.

Abhilash L R
  • 805
  • 1
  • 9
  • 24
  • Where does `items` come from? What does it contains? – Terseus Jun 06 '16 at 07:56
  • Items is a property passed from a helper. The helper takes these properties and creates the DOM with actions. – Abhilash L R Jun 06 '16 at 09:32
  • Possible duplicate of [Dynamically compile a HTMLBars template at runtime in Ember 2.5](http://stackoverflow.com/questions/37345098/dynamically-compile-a-htmlbars-template-at-runtime-in-ember-2-5) – Max Wallace Jun 07 '16 at 12:30

0 Answers0