关闭ngDialog时调用函数

时间:2017-04-19 04:06:17

标签: angularjs

我用ok按钮打开一个警告对话框。点击调用一个函数。我关闭警告对话框时需要调用相同的函数

<script type="text/ng-template" id="alertErrorTemplate.html">
    <div class="form-wrp">
        <div class="form-item">
            <h2 class="box-title error-text" ng-class="{'box-left': leftAlign}"><span data-ng-bind="Web_Error" ng-show="showTitleText">Error: </span>{{alertText}}</h2>
            <h2 class="box-text error-text" ng-class="{'box-left': leftAlign}" ng-show="secondaryText !== null">{{secondaryText}}</h2>
            <div ng-show="alertItemList && alertItemList.length > 0" class="dialog-error-list error-text">
                <ul>
                    <li ng-repeat="item in alertItemList">
                        {{ item }}
                    </li>
                </ul>
            </div>
        </div>
        <div class="form-item text-center">
            <button ng-click="closeNgDialog()" class="btn btn-success btn-big" data-ng-bind="Web_OK">OK</button>
        </div>
    </div>
</script>

1 个答案:

答案 0 :(得分:0)

您可以像这样收听'ngDialog.closing'事件:

$scope.$on('ngDialog.closing', function () {
    //do what ever you want.
});