jeudi 5 mars 2015

Render a component from a dynamic variable with Handlebars

I'd like to render a component that I will define within a variable.


I have a variable containing content like that:


page.js



Ember.Controller.extend({
c: {
'pageTitle': 'This is the title with a component {{my-component}}'
}
});


page.hbs



<div>
{{c.pageTitle}}
</div>


The c object is populated from an API call, from a content server. I would like to provide the capability to inject components from what is defined in the content.


Basically what I need would be to render 2 times, the first time to replace my {{pageTitle}} with the string, and the second time to replace {{my-component}} with the component.


What would be the best solution to do such a thing?


Thanks





Aucun commentaire:

Enregistrer un commentaire