我正在使用angular-ui-router-uib-modal,我有一个问题。
当我关闭我的模式(确认成功/失败的操作(时,我需要重新加载下面的页面(显示数据列表(。如下面的示例所示,我可以在"关闭"按钮和"X 符号"中指定该行为以关闭模式(使用 ui-sref-opts="{reload: true}"
(。
但。。。当用户单击模式并自动关闭模式本身时,如何指定相同的操作?
<div class="modal-content">
<div class="modal-header">
<div class="bb8-modal-close" ui-sref="home.gestioneFondi({gestione:true, innescatoDaMenuLaterale:false})" ui-sref-opts="{reload: true}">
<span class="visuallyhidden glyphicon glyphicon-remove-circle"/>
</div>
<h4 class="modal-title modal-title-font">Info</h4>
</div>
<div class="modal-body" ng-switch="esito">
<p class="text-center modal-body-font" ng-switch-when="true">Success</p>
<p class="text-center modal-body-font" ng-switch-when="false">Error</p>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ui-sref="home.gestioneFondi({gestione:true, innescatoDaMenuLaterale:false})" ui-sref-opts="{reload: true}">Chiudi</button>
</div>
</div>
感谢您的任何帮助
因此,当您打开这样的模态时,它会返回承诺:
var modalInstance = $modal.open({..}(;
您可以在承诺上指定模式关闭事件
modalInstance.result.then(function (result( {..}(;
您可以指定以下代码来重新加载状态。
$state.reload((;
要使上述工作,您必须在控制器中注入$state
依赖项。
app.controller('controller', ['$state',function($state({..}](