This scenario is hypothetical (sort of) but bear with me:
Imagine that I have a server that manages all communications from clients and customers. A client can send me an email via standard means (outlook, gmail, etc) and I will receive it. My server will parse it and store it as an html string.
<div>Hello world</div>
<div>Second Line</div>
<img width="10px" height="10px" src="http://ift.tt/2g7NbR3">
<img width="10px" height="20px" src="http://ift.tt/2glGaPz">
<div>That picture is great</div>
Then when I query for the conversation I receive a list of messages back, which in turn each have their inner html defined above. But sadly none of them have the wonderful trappings of ember :(
Now say that hypothetically I would have liked to wrap that image into its own component, let's say to make its source and dimensions dynamic.
Ideally I would separate out the images and extract the relevant key-value pairs, then throw that handlebars templating into the dom and (assuming I had a dynamic-img
component already defined) it would work. However this is not the case.
How can I automagically convert this html text into ember components? Let's say that I have no access to the server.
ember, ember-data, ember-cli => 2.9.x
Aucun commentaire:
Enregistrer un commentaire