mseemann / angular2-mdl

Angular 2 - 14 components, directives and styles based on material design lite (npm: @angular-mdl/core)
https://mseemann.io/angular2-mdl
MIT License
558 stars 93 forks source link

MdlDialog problem after close dialog by clicking outside #1578

Closed Krzysiek-SS closed 6 years ago

Krzysiek-SS commented 6 years ago

When I closed MdlDialog by clicking outside, MdlDialog have been closed but when I click then somewhere else then I get following error in console:

Uncaught TypeError: Cannot read property 'config' of null at MdlDialogService.onBackdropClick (mdl-dialog.service.js?908b:230) at eval (mdl-dialog.service.js?908b:59) at SafeSubscriber.schedulerFn [as _next] (core.js?09c9:3567) at SafeSubscriber.__tryOrUnsub (Subscriber.js?1453:209) at SafeSubscriber.next (Subscriber.js?1453:147) at Subscriber._next (Subscriber.js?1453:80) at Subscriber.next (Subscriber.js?1453:55) at EventEmitter.Subject.next (Subject.js?2bd2:47) at EventEmitter.emit (core.js?09c9:3539) at eval (mdl-dialog-outlet.service.js?4c87:42)

The problem is here ... MdlDialogService.prototype.onBackdropClick = function () { var topMostModalDialog = this.getTopMostInternalDialogRef(); if (topMostModalDialog.config.clickOutsideToClose) { topMostModalDialog.hide(); } }; ....

For me it seems that in first click outside this code works, but when dialog is closed and user perform second click, this code is fire again when the topMostModalDialog does not exist anymore.

It is replicated all time, for many different type of modal. When modal is closed in any other way than clicking outside everything is works perfectly.

Krzysiek-SS commented 6 years ago

Some details : "dependencies": { "@angular-mdl/core": "^6.0.0", "@angular/animations": "6.1.6", "@angular/common": "6.1.6", "@angular/compiler": "6.1.6", "@angular/core": "6.1.6", "@angular/forms": "6.1.6", "@angular/platform-browser": "6.1.6", "@angular/platform-browser-dynamic": "6.1.6", "@angular/router": "6.1.6", "core-js": "2.5.7", "font-awesome": "4.7.0", "jquery": "3.3.1", "moment": "2.22.2", "moment-locales-webpack-plugin": "^1.0.7", "ng-circle-progress": "^1.2.0", "ng-jhipster": "0.5.4", "ng-recaptcha": "^3.0.5", "ng2-google-charts": "^3.4.0", "ng2-semantic-ui": "0.9.7", "ng5-slider": "^1.1.3", "ngx-cookie": "2.0.1", "ngx-infinite-scroll": "0.8.1-1", "ngx-pagination": "^3.2.0", "ngx-webstorage": "2.0.1", "reflect-metadata": "0.1.12", "rxjs": "6.3.1", "rxjs-compat": "6.3.1", "sockjs-client": "1.1.5", "tether": "1.4.4", "tslib": "1.9.3", "webdriver-manager": "^12.1.0", "webstomp-client": "1.2.4", "zone.js": "0.8.26" },