[英]How to pass data into a <a> tag like link_to rails
I'm trying to transform this ruby link_to method into a classic tag. 我正在尝试将此ruby link_to方法转换为经典标记。 And before i'd use to pass some value (idz) into the parse after the link tag.
并且在我使用链接标记之后将一些值(idz)传递到解析之前。
Is it possible to do the same with tags. 是否可以对标签做同样的事情。 Is because I need this value (idz) to run my controller method
是因为我需要此值(idz)才能运行控制器方法
Before : 之前:
<%= link_to rem_admin_group_path(group, idz: admin.id), method: :patch, remote: true do %>
<div class="btn btn-danger pull-right"style='margin-left: 10px;'>
<i class="fa fa-close" aria-hidden="true" ></i>
</div>
<% end %>
After (without the value idz): 之后(无idz值):
<a href="groups/<%=group.id%>/rem_admin", data-method="patch" data-remote="true">
<div class="btn btn-danger pull-right"style='margin-left: 10px;'>
<i class="fa fa-close" aria-hidden="true" ></i>
</div>
</a>
You can try something like this 您可以尝试这样的事情
<a href="groups/<%=group.id%>/rem_admin?idz=<%=admin.id%>", data-method="patch" data-remote="true">
<div class="btn btn-danger pull-right"style='margin-left: 10px;'>
<i class="fa fa-close" aria-hidden="true" ></i>
</div>
</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.