I need to render a dynamic template, with any number of dynamic parts, each requiring data from the server, not known until the component is loaded.
My case:
Inside a component, I am rendering some extended markdown. This markdown can contain links which will be detected, and then dynamic information must be loaded in to complete the final render.
For this example, I am making a sports game with many users. Each user has a club. Users are to be able to create posts where they paste a link to their club. The extended markdown parser recognises this link, grabs the club ID, and then loads in the club's name from the API. These types of links may be many, and of various types, such as players, stadiums, etc.
It should be noted that the final markdown parser is an ember addon, so I don't have control of the final output and can't use Route.render with injected helpers.
My question is if there is a more 'ember' way to accomplish this with bindings, templates, etc. than what I have in mind so far - which is to do it all manually by injecting html such as <span id="id"></span> into the markdown, then load the data from the API while ember continues, and when the data is available update the rendered html?
Aucun commentaire:
Enregistrer un commentaire