Write data attributes on HAML ?

if you write on haml and use data attribute,

1
%a{"data-slide" => "prev", href: "#carousel-example-generic", role: "button"}

but you should style of write can be like below :

1
%a{:data => {:slide => 'prev'}, href: '#carousel-generic'}

OR

1
%li{"data-target" => ".nav-collapse", "data-toggle" => "collapse"}

like below

1
%li{:data => {:toggle => 'collapse', :target => '.nav-collapse'}}

If you want, you can look at this page for details .

That’s all

I hope helped to you.

Comments