My specific situation for this question involves transforming inbound links into LinkComponents that use actions to scroll, but it's perhaps better to generalize it: what's the proper method to convert inbound REST data into an ember component?
An example: say I have the string <a href="#foo">Foo anchor link</a> coming in from data source of choice. I have written a custom adapter and serializer to properly transform the inbound data to jsonapi standards, and I've defined a model to store it.
I wish to convert these anchors to components, or in general, to something that contains 'data-ember-action', much like all the template-rendered content that already exist elsewhere in my app. For awhile I believed that RenderBuffer was the solution to my problem - simply create the component I wish to replace the anchor substring with, render it to a RenderBuffer, and use that to get the corresponding string output that I can then insert in the content. I have a (possibly unfounded) suspicion, however, that this is oversimplifying the problem, and neglects certain internal operations that occur behind the scenes during template rendering in Ember. It also appears that RenderBuffer is deprecated, meaning that even if this is a viable approach currently, it is not the appropriate way to do this.
Anyone have any advice on how to approach this issue?
Aucun commentaire:
Enregistrer un commentaire