lundi 19 octobre 2015

Converting string templates to usable, ember template

My api gives me template strings like '[[user]] commented on 6 images' and then a data object like {user: {val: 'Daniel', id: '...'}}.

I'm trying to figure out how to make a helper to convert that into a usable HTMLBars template, add a link-to component for the user, and output it. So essentially get the helper to return something like

'{{link-to user.val 'user' user.id}} commented on 6 images'

that's actually usable in a template.

I've tried something along the lines of Ember.HTMLBars.template('{{link-to ...}} commented...') but not really sure how to go from there. Do I need to include the ember-template-compiler? I'd like to try to avoid it since it adds a few hundred kbs to vendor.js. I'm also using ember-cli if that changes anything.




Aucun commentaire:

Enregistrer un commentaire