First of all, ember's component helper doesn't help in this case. That would only help if I knew how many components I needed to render, and in what order.
I need to be able to render components based on a string like:
{{user}} has made a bid of {{bid}}, where:
{{user}}and{{bid}}will be replaced with components.- the given string is unknown, with an unknown number of dynamic sections representing components (The components would be passed in with the given string).
If these dynamic sections were helpers, this would be easy - but helpers just don't cut it for certain items in my game.
Ideally I could do something like this:
{{translated-content
content='{{user}} has made a bid of {{bid}}'
user=(component 'user-ui')
bid=(component 'bid-ui') }}
Is this possible with ember?
With some help, I've come up with the following component which works with ember-i18n, and ember 1.11 or later.
It could likely be optimised further, but it works nice and fast the way it is.
Create a new component
ember g component t-ttemplate.hbs
component.js
Usage