【问题标题】:anchor tag in ui.bootstrap modal is not workingui.bootstrap 模式中的锚标记不起作用
【发布时间】:2016-06-06 08:54:28
【问题描述】:

我是 Angular 的新手。我已经使用 angular ui.bootstrap 创建了一个模态。我有一个带有外部链接的锚标签。如果我单击锚标记,则新窗口不会打开。任何 preventDefault 都应用于模态?

$uibModalInstance = $uibModal.open({
            animation: true,
            template: '<div class="modal-header "><h3 class="modal-title">{{modalTitle}}<a href="javascript:void(0);" class="icon icon-page_close_grey" ng-click="cancel()"></a></h3></div>' +
                '<div class="modal-body">' + data + '</div><div class="modal-footer"></div>',
            size: 'lg',
            backdrop:'static',
            controller: modalcontroller
        });

这里我的数据包含一个带有 href="http://www.google.com" , target="_blank" 的标签。有没有人可以帮忙

【问题讨论】:

  • 使用ng-bid-html 将锚标记插入div.modal-body

标签: angularjs ui.bootstrap


【解决方案1】:

试试这个方法:

'<div class="modal-body" ng-non-bindable>' + data +
    '</div><div class="modal-footer"></div>'

Angular 将忽略具有ng-non-bindable 属性的元素,因此锚标记将表现为普通的 html 标记。

【讨论】:

  • @user2587222 锚点不可点击?还是根本不显示?
  • 它的显示。但不可点击。新窗口未打开
  • @user2587222 如果它有效,我怎样才能找到问题? :) 看看控制台有没有错误。
猜你喜欢
  • 2019-10-07
  • 1970-01-01
  • 2013-06-12
  • 2013-12-02
  • 1970-01-01
  • 2020-09-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多