AngularJs $ mdDialog关闭禁用页面

时间:2019-01-29 13:47:09

标签: javascript angularjs modal-dialog freeze mddialog

我在关闭mdDialog时遇到问题 这是closePop 我试图使用.hide()函数,但是我有同样的问题 { $mdDialog.cancel(); // $mdDialog.hide(); }

当我点击对话框上的关闭按钮时,主视图有点冻结,ng-click不再起作用,这是模板:`

<!--<div layout="row" class="tab-body room-tab-item" layout-wrap>-->

    <div elem-ready="$ctrl.loadData($ctrl.broadcaster.id)"></div>
<div class="calendar-tab-header"> Click on a date to add it into your time table</div>
<div>Items are displayed in your current time zone.</div>
    <div class="calendar-tab-success">{{$ctrl.success}}</div>
    <div class="calendar-tab-error">{{$ctrl.error}}</div>
    <table class="calendar-tab-my-timetable">
        <thead>
        <tr>
            <th>Date and Hour</th>
        </tr>
        </thead>
    </table>


        <button ng-repeat="schedule in $ctrl.schedules" ng-click="$ctrl.checkIn(schedule.id)">
            <td><div class="calendar-tab-date">{{schedule.date}}</div>
                <div class="calendar-tab-hour">{{schedule.startHour}}:00</div>
            </td>
            <!--<td>{{game.release}}</td>-->
        </button>



</div>

` checkIn函数仅加载模态,在第一次单击时它起作用,但是当我使用关闭模态函数时,它关闭模态,但是我不能再次单击按钮再次显示模态,我认为它禁用了ng-点击

    $mdDialog.show({
                controllerAs: 'ctrl',
                templateUrl: 'modal.view.html',
                parent: angular.element(document.body),
                // targetEvent: ev,
                clickOutsideToClose: false,
                scope: $scope
            }).then(function (scope) {
            }, function () {});

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

添加

preserveScope:true

 $mdDialog.show({
                controllerAs: 'ctrl',
                templateUrl: 'modal.view.html',
                parent: angular.element(document.body),
                // targetEvent: ev,
                preserveScope: true,
                clickOutsideToClose: false,
                scope: $scope
            }).then(function (scope) {
            }, function () {});