Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property '$destroy' of null #175

Open
AlanAlbuquerque opened this issue Sep 18, 2016 · 5 comments
Open

TypeError: Cannot read property '$destroy' of null #175

AlanAlbuquerque opened this issue Sep 18, 2016 · 5 comments

Comments

@AlanAlbuquerque
Copy link

AlanAlbuquerque commented Sep 18, 2016

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!

@eraye1
Copy link

eraye1 commented Oct 4, 2016

Have this same issue. :(

@yupswing
Copy link

yupswing commented Oct 5, 2016

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 #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
Copy link

yupswing commented Oct 5, 2016

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?

@sharpfuryz
Copy link

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.

@tiagomsmagalhaes
Copy link
Contributor

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

dwmkerr added a commit that referenced this issue Aug 11, 2018
Prevent null error if modal is already destroyed | related issue #175
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants