Home > Net >  AngularJs $mdDialog close disables page
AngularJs $mdDialog close disables page

Time:02-03

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"  layout-wrap>-->

    <div elem-ready="$ctrl.loadData($ctrl.broadcaster.id)"></div>
<div > Click on a date to add it into your time table</div>
<div>Items are displayed in your current time zone.</div>
    <div >{{$ctrl.success}}</div>
    <div >{{$ctrl.error}}</div>
    <table >
        <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 >{{schedule.date}}</div>
                <div >{{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?

CodePudding user response:

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