Pergunta

I'm trying to convert my knockoutJs html code to HAML, trying to achieve something after compilation like:

<div data-bind="attr: { 'data-something': someValue }">...</div>

So I try:

%div{data:{bind:"attr: { 'data-something': someValue }"}}

But using haml_assets 0.1.0 I get:

<div data-bind="attr: { "data-something': someValue }'>...</div>

So my last resort was go back to:

== <div data-bind="attr: { 'data-something': someValue }">...</div>

Is this a bug in HAML, and/or is there a neater way to achive this?

Foi útil?

Solução

This is an issue on haml_assets 0.1.0. A ticket was created for this: https://github.com/infbio/haml_assets/issues/10

There is also a better workaround for it until it is fixed:

%div{data:{bind:'attr: { "data-something": someValue }'}}

Outras dicas

Try this:

%div(data-bind="attr: { 'data-something': someValue }")

When I did this in a RoR app that uses HAML I get this rendered:

<div data-bind="attr: { 'data-something': someValue }"></div>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top