关闭 href link 上的引导框警报单击
Closing bootbox alert on href link click
我在我的 angular2 应用程序中使用 bootbox 警报向 UI 上的用户显示信息。我在警报消息中显示 href links。当用户点击任何 href links 时,页面应该导航到那个 link 并且引导框警报模式应该关闭。
在我的代码中,页面导航到 href link。但是,模态没有关闭。我怎样才能做到这一点?
下面是我的代码:
bootbox.alert({
title: "Select option for profile #"+this.profileId,
message:
"<a href=\"#/profile-details/"+this.profileId+"\">View/Update</a><br>" +
"<a href=\"#/status-update/"+this.profileId+"/"+this.status+"\">Deactivate/Reactivate</a><br>"+
"<a href=\"#/adhoc-request/"+this.profileId+"/"+this.status+"\">Ad Hoc Request</a><br>"+
"<a href=\"#/internal-resend/"+this.profileId+"\">Internal Download</a><br>"+
"<a href=\"#/audit-tracking/"+this.profileId+"\">Audit Tracking</a><br>"
});
感谢任何意见!
您可以捕获创建的模态对象(参见https://jsfiddle.net/q1Lm385a/1/):
var $mymodal = bootbox.alert({
title: "Select option for profile #"+this.profileId,
message:
"<a href=\"#/profile-details/"+this.profileId+"\">View/Update</a><br>" +
"<a href=\"#/status-update/"+this.profileId+"/"+this.status+"\">Deactivate/Reactivate</a><br>"+
"<a href=\"#/adhoc-request/"+this.profileId+"/"+this.status+"\">Ad Hoc Request</a><br>"+
"<a href=\"#/internal-resend/"+this.profileId+"\">Internal Download</a><br>"+
"<a href=\"#/audit-tracking/"+this.profileId+"\">Audit Tracking</a><br>"
});
这将使手动关闭模态变得相对容易:
$mymodal.on('click', '.bootbox-body a', function(e){
$mymodal.modal('hide');
});
Bootbox 还有一个 global function 你可以调用:
$mymodal.on('click', '.bootbox-body a', function(e){
bootbox.hideAll();
});
我在我的 angular2 应用程序中使用 bootbox 警报向 UI 上的用户显示信息。我在警报消息中显示 href links。当用户点击任何 href links 时,页面应该导航到那个 link 并且引导框警报模式应该关闭。
在我的代码中,页面导航到 href link。但是,模态没有关闭。我怎样才能做到这一点? 下面是我的代码:
bootbox.alert({
title: "Select option for profile #"+this.profileId,
message:
"<a href=\"#/profile-details/"+this.profileId+"\">View/Update</a><br>" +
"<a href=\"#/status-update/"+this.profileId+"/"+this.status+"\">Deactivate/Reactivate</a><br>"+
"<a href=\"#/adhoc-request/"+this.profileId+"/"+this.status+"\">Ad Hoc Request</a><br>"+
"<a href=\"#/internal-resend/"+this.profileId+"\">Internal Download</a><br>"+
"<a href=\"#/audit-tracking/"+this.profileId+"\">Audit Tracking</a><br>"
});
感谢任何意见!
您可以捕获创建的模态对象(参见https://jsfiddle.net/q1Lm385a/1/):
var $mymodal = bootbox.alert({
title: "Select option for profile #"+this.profileId,
message:
"<a href=\"#/profile-details/"+this.profileId+"\">View/Update</a><br>" +
"<a href=\"#/status-update/"+this.profileId+"/"+this.status+"\">Deactivate/Reactivate</a><br>"+
"<a href=\"#/adhoc-request/"+this.profileId+"/"+this.status+"\">Ad Hoc Request</a><br>"+
"<a href=\"#/internal-resend/"+this.profileId+"\">Internal Download</a><br>"+
"<a href=\"#/audit-tracking/"+this.profileId+"\">Audit Tracking</a><br>"
});
这将使手动关闭模态变得相对容易:
$mymodal.on('click', '.bootbox-body a', function(e){
$mymodal.modal('hide');
});
Bootbox 还有一个 global function 你可以调用:
$mymodal.on('click', '.bootbox-body a', function(e){
bootbox.hideAll();
});