如何在rails中使用带有link_to的bootstrap Modal? [英] How to use bootstrap Modal with link_to in rails?

查看:52
本文介绍了如何在rails中使用带有link_to的bootstrap Modal?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前问过这个问题,但不幸的是我仍然被卡住了.我有一个像这样的链接

<%= link_to "Click Here", page_path,, :id =>'登录', "数据切换" =>模态"%>

在 page.html.erb(当链接被点击时我想以模态加载的页面),我有

在 assets/page.js.coffee

$('#loginModal').modal(options)

但是,链接没有在模态中打开有什么帮助吗?

解决方案

添加 data-target

<%= link_to "Click Here", page_path, :id =>'登录', "数据切换" =>模态",数据目标"=>'#loginModal' %>

I had asked this earlier but unfortunately I am still stuck. I have a link_to like this

<%= link_to "Click Here", page_path,, :id => 'login', "data-toggle" => "modal" %>

in page.html.erb (the page which I want to load in modal when the link gets clicked),I have

<div class="modal" id="loginModal">
    Test Content
</div>

in assets/page.js.coffee

$('#loginModal').modal(options)

but still, the link is not opening in a modal Any help ?

解决方案

Add data-target

<%= link_to "Click Here", page_path, :id => 'login', "data-toggle" => "modal", 'data-target' => '#loginModal' %>

这篇关于如何在rails中使用带有link_to的bootstrap Modal?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆