component / reactive

Tiny reactive template engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

+ operator for concatenating text

timoxley opened this issue · comments

A common usecase for creating View helpers is simply concatenating text onto existing data… perhaps this could be handled simply in the template.

e.g.

<a data-href="id + /comments">comments</a>

Though then you might end up still needing view helper if you need to prepend text or other types of interpolation

Just a thought.

maybe generic interpolation, since you might want to prefix as well:

<a data-href="/user/{id}">Tobi</a>
<div data-class="user-{id}"></div>

I dunno

commented

+1 for interp

not super happy adding this to Binding#value() since it's completely unrelated, could move it to a helper function but anyway: https://github.com/component/reactive/compare/add;interpolation#L0R23

Looks good to me. Perhaps there's some way to make this kind of "binding value parsing" more generic?

in this case I think I'll just move it to a util.interpolate() and move it into the bindings we define, custom bindings would have to utilize if they wanted to

0.8.0 ! they're not currently passed through the formatters, so you cant for example do data-text="Created {created_at | date}" but we should just have to change the one method call for that