【问题标题】:Drop-down link requires more than one click to open the pop up下拉链接需要多点点击才能打开弹窗
【发布时间】:2019-05-06 18:11:25
【问题描述】:

我已将我的用户操作链接放在一个下拉列表中,它应该会根据要单击的链接打开一个弹出表单或对话框。我正在使用引导程序 4。

这是我的代码:

findUser($) {
        this.user.getById($.target.id).subscribe(res => {
            if (res.success === true) { this.isEdit = true; this.singleUser = res.data[0]; console.log('editable', this.singleUser) }
            else {
                this.toastr.error('An Error Occured, Please Try Again.', '', {
                    timeOut: 3000,
                    positionClass: 'toast-top-center'
                });
            }
        })
    }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<td>
  <div class="dropdown">
    <button class="btn btn-info dropdown-toggle" aria-haspopup="true" aria-haspopup="true" type="button" data-toggle="dropdown">Action
    <span class="caret"></span></button>
    <ul class="dropdown-menu">
      <li><a id='{{item._id}}' (click)='findUser($event)' data-toggle="modal" data-target="#m_modal_5">Edit</a></li>
      <li><a id="{{item._id}}" (click)='deleteUser($event)'>Delete</a></li>
    </ul>
  </div>
</td>

谁能告诉我是什么问题?我试过谷歌,但这些解决方案没有用。

已解决: https://github.com/angular-ui/bootstrap/issues/2294

【问题讨论】:

  • 能否也贴出处理按钮请求的代码?
  • 也许这篇文章会对你有所帮助POST
  • 你的 sn-p 抛出异常:"Uncaught SyntaxError: Unexpected token {"
  • @JonathanWilson 您在 Angular 应用程序中尝试过吗?我在角度工作。
  • 我不打算去创建一个 Angular 应用程序,以便我可以运行你的 sn-p。那是你的责任。确实,如果您希望帮助解决您的问题,这是您至少可以做的。另外,当您构建一个简单(且可运行)的问题演示时,您很可能会自己发现原因。还有什么比那个更好呢? stackoverflow.com/help/how-to-ask

标签: html typescript bootstrap-4


【解决方案1】:

所以我删除了 data-toggle='dropdown' 并开始工作。请点击此链接了解更多信息。

https://github.com/angular-ui/bootstrap/issues/2294

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-16
    • 1970-01-01
    • 2016-06-08
    • 2019-12-02
    • 1970-01-01
    • 1970-01-01
    • 2019-11-05
    • 1970-01-01
    相关资源
    最近更新 更多