angular-fancy-modal
angular-fancy-modal copied to clipboard
Uncaught TypeError: Cannot read property '$destroy' of undefined
Internals of this module throw TypeError exception while modal is being dismissed
cleanUp @ angular-fancy-modal.js:96
(anonymous function) @ angular-fancy-modal.js:127
eventHandler @ angular.js:3032
My controller:
.controller('SessionCtrl', function ($scope, $fancyModal) {
var modalOpt = {
templateUrl: 'views/session/greeting.html'
};
$fancyModal.open(modalOpt);
});
debugger says that $modal.scope() returns undefined
BTW, I'm experiencing that while using angularjs 1.3.15
could you please set up a jsfiddle?
Yeah, sure: http://embed.plnkr.co/DpTYA4cOh44iwKeXNdef/
I'm almost sure it's related to the debug info. It will work if you will remove this block:
app.config(function ($compileProvider, $logProvider) {
$compileProvider.debugInfoEnabled(false);
$logProvider.debugEnabled(false);
});
Check out changes between 1.3.x and 1.2.x for angular.element: https://code.angularjs.org/1.3.3/docs/api/ng/function/angular.element
I guess it's because
$compileProvider.debugInfoEnabled(false);
This line basically makes impossible to retrieve the scope from an angular.element
for some reason.
I also see this.
https://docs.angularjs.org/guide/production#disabling-debug-data
Probably the only solution is to avoid getting the scope from DOM element. To do so I should probably keep track of created scope in some different way.
yeah this will be breaking change if this module wants to be compatible with 1.3.x maybe you could track $destroy event of that DOM element instead (it's available even with debug info disabled)
what do you mean?