Reputation: 2966
I need my haml to generate a tag with '{{ }}' inside the < >. It's not an attribute, I would like it to paste plain text inside the tag. For example:
<a href="..." {{bindAttr class="App.ready:ready"}}>...</a>
I searched in the documentation but I could not find how... is this possible with the haml syntax?
Upvotes: 6
Views: 1501
Reputation: 895
I use plain HTML when I need Handlebars inside opening and closing tags.
%div
<div {{action clickAction}}>
Click Here
</div>
It's ugly, but since HAML has no native way of doing this, it's much better than using another library or complicated hack that somebody invented.
There's not that many of these cases anyway.
Upvotes: 3
Reputation: 2886
I use the following to pour out "safe" text:
Ember.Handlebars.registerHelper('raw', function (name) {
return new Handlebars.SafeString(this.get(name) || name);
});
...
{{raw myProperty}}
Upvotes: 0
Reputation: 1
= '<a href="..." {{bindAttr class="App.ready:ready"}}>...</a>'
If you need string interpolation, you'd have to use double quotes or here-docs and escape appropriately.
Upvotes: 0