【问题标题】:angular-ui-router-uib-modal: reload page below when click outside the modalangular-ui-router-uib-modal:在模态外单击时重新加载下面的页面
【发布时间】:2018-03-14 04:18:20
【问题描述】:

我正在使用 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>


感谢您的帮助

【问题讨论】:

标签: angularjs modal-dialog bootstrap-modal angular-ui-bootstrap


【解决方案1】:

因此,当您打开这样的模式时,它会返回承诺:

var modalInstance = $modal.open({..});

你可以在 promise 上指定模态关闭事件

modalInstance.result.then(function (result) {..});

您可以指定以下代码来重新加载状态。

$state.reload();

要使上述工作正常,您必须在控制器中注入 $state 依赖项。

app.controller('controller', ['$state',function($state){..}])

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-08
    • 1970-01-01
    • 1970-01-01
    • 2015-06-09
    • 1970-01-01
    • 2019-08-23
    • 2016-10-19
    • 2014-11-18
    相关资源
    最近更新 更多