Model data containing template strings


#1

Hi all.

I’m bringing this question here (asked once before slightly differently on StackOverflow) because I’m looking for guidance on what others do when they encounter this sort of situation in ember.

Assume the most recent version of ember, and Ember-CLI as an environment. Imagine that you have a simple model:

export default DS.Model.extend({
    title: DS.attr("string"),
    content: DS.attr("string")
});

And that ‘content’ contains some data either mocked into place or pulled from some remote source: <p>Hello world. Look at my component: {{my-nifty-component}}</p>

The question is, how does one transform that component present in the data into an actual component?

When I originally asked about this, I was directed towards {{component}} as a solution, but that seems to be suited for situations where you know you need a component already, and you just need to be able to flexibly determine which one it is. I thought I had made some headway perusing solutions that included RenderBuffer,but it looks like that bit’s going away.

My specific situation involves converting anchor tag links in my inbound data to components that I can then cause to fire off an action to invoke scrolling, but I’m also interested in a more general application of this question. Can one generate components from data, not just from templates?