javascriptangularjsmodal-dialogfreezemddialog

AngularJs $mdDialog close disables page


I have a problem when closing mdDialog, here is the closePop I tried to use .hide() function but I have the same problema { $mdDialog.cancel(); // $mdDialog.hide(); }

When I hit the close button on the Dialog, the main view kinda freeze, the ng-click does not work anymore, here is the template: `

<!--<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>

` the checkIn function only loads the modal, on the first click it works but when I use the close modal function, it closes the modal, but I cannot click again on the buttons to show the modal again, I think it disables the ng-click

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

Can someone help me please?


Solution

  • Add

    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 () {});