Haml and Handlebars, how to avoid text between '<' '>'?

I need my haml to create a tag with '{{}}' inside <>. This is not an attribute, I would like it to insert plain text inside the tag. For instance:

 <a href="..." {{bindAttr class="App.ready:ready"}}>...</a> 

I searched in the documentation but couldn't find how ... is this possible with the haml syntax?

+6
source share
3 answers

I use simple HTML when I need steering panels inside opening and closing tags.

 %div <div {{action clickAction}}> Click Here </div> 

This is ugly, but since HAML does not have its own way of doing this, it is much better than using another library or a complex hack that someone came up with.

In any case, not so many of these cases.

+3
source

= '<a href="..." {{bindAttr class="App.ready:ready"}}>...</a>'

If you need string interpolation, you will have to use double quotes or here-documents and follow the appropriate steps.

0
source

I use the following to pour "safe" text:

 Ember.Handlebars.registerHelper('raw', function (name) { return new Handlebars.SafeString(this.get(name) || name); }); 

...

 {{raw myProperty}} 
0
source

Source: https://habr.com/ru/post/910908/


All Articles