angular-modal-service
angular-modal-service copied to clipboard
TypeError: Cannot read property '$destroy' of null
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!
Have this same issue. :(
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.
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?
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.
I have implemented an Escape listening directive which executes the modal function and i get the same error