angular-modal-service icon indicating copy to clipboard operation
angular-modal-service copied to clipboard

TypeError: Cannot read property '$destroy' of null

Open AlanAlbuquerque opened this issue 8 years ago • 5 comments

First of all, thanks for this amazing plugin.

On:

//  We can now clean up the scope
modalScope.$destroy();

Got:

TypeError: Cannot read property '$destroy' of null
    at angular-modal-service.js:144
    at processQueue (angular.js:16383)
    at angular.js:16399
    at Scope.$eval (angular.js:17682)
    at Scope.$digest (angular.js:17495)
    at angular.js:17721
    at completeOutstandingRequest (angular.js:5964)
    at angular.js:6243

Bye!

AlanAlbuquerque avatar Sep 18 '16 01:09 AlanAlbuquerque

Have this same issue. :(

eraye1 avatar Oct 04 '16 01:10 eraye1

Same problem

angular.js:13920 TypeError: Cannot read property '$destroy' of null
    at angular-modal-service.min.js:1
    at angular.js:16383
    at m.$eval (angular.js:17682)
    at m.$digest (angular.js:17495)
    at angular.js:17721
    at e (angular.js:5964)
    at angular.js:6243

Could it be connected to https://github.com/dwmkerr/angular-modal-service/issues/92 ? because if I comment the modal.element.on('hidden.bs.modal') block no error at all. Here is my code to invoke the modal

        // 'then' is a callback function
        modal.element.modal(); //show it
        modal.element.find('button.focus-here').focus();
        modal.element.on('hidden.bs.modal', function() {
          if (!modal.controller.closed) {
            modal.scope.close(false); //default cancel is FALSE
          }
        });
        modal.close.then(function(result) {
          if (then) then(result);
        }).catch(function(error) {
          console.log(error);
          if (then) then(false);
        });

the error does not effect any behaviour in the modal, but it is annoying and could underlie some wasted resources.

yupswing avatar Oct 05 '16 11:10 yupswing

That for sure clean up the error, but as it is it's not a big deal. The point is: with that 'if' does the modal get completely destroyed anyway?

yupswing avatar Oct 05 '16 12:10 yupswing

I got this error in this case: <a href="#" ng-click="close()">X</a> So when I removed href attribute - error disappear. I suppose this issue occurs when your childscope has to do something, but it is destroyed.

sharpfuryz avatar Mar 15 '17 08:03 sharpfuryz

I have implemented an Escape listening directive which executes the modal function and i get the same error

tiagomsmagalhaes avatar Jan 30 '18 11:01 tiagomsmagalhaes