简体   繁体   中英

passing data attribute to rails link_to block

Trying to disable turbolinks in a link_to block

Here's what I have now, and does what I need it too except for disable turbolinks.

<%= link_to posts_path do %>   
    <li class="nav-icon nav-icon-home">
            <span aria-hidden="true" class="glyphicon glyphicon-home" data-icon="&#x25a8;"></span>
            <span class="nav-icon-text">Home</span>
    </li> 
<% end %>

Now, to use the above and disable turbolinks I'd like to do something like this...

<%= link_to posts_path, :data => { :no_turbolink => true }do %>   
    ...
<% end %>

Give a space between { :no_turbolink => true } and do :

<%= link_to posts_path, :data => { :no_turbolink => true } do %>   
    ...
<% end %>

Try this

<%= link_to posts_path , :data => { :no_turbolink => true } do %>   
 <li class="nav-icon nav-icon-home">
        <span aria-hidden="true" class="glyphicon glyphicon-home" data-icon="&#x25a8;">      </span>
        <span class="nav-icon-text">Home</span>
</li> 
<% end %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM