How can I bind an attribute and concatenate some plaintext with it?
For example:
<span {{bindAttr title="updates 'revisions'"}}>{{updates}} revisions</span>
To produce:
<span title="4 revisions">4 revisions</span>
Is there a way to do this without writing a new helper? I feel like I have to write a helper for every simple thing with Handlebars...
You can add to you model new calculated field
App.Revisions = Em.Object.extend({
updates:5,
updatesTitle:function(){
return this.get('updates') + ' revisions';
}.property('updates'),
});
In Handlebars change to:
<span {{bindAttr title="updatesTitle"}}>{{updates}} revisions</span>
or
<span {{bindAttr title="updatesTitle"}}>{{updatesTitle}}</span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With