InfomediaLtd/angular2-materialize

Problem with Modal when used browser back navigation used

akashbiz opened this issue · 1 comments

Hello,
I have used materializecss modal in my angular2 project. I am facing an issue, when I open a modal and click on browser's back nagivation, popup gets close without executing close modal method written in component but overlay stay's at it is and website gets block. is there anything i am missing or have anyone face this issue before?
This issue also replicates on Official Demo of Angular2-materialize, please check here https://infomedialtd.github.io/angular2-materialize/#/Dialogs

I generally set modals to open on there own named router-outlet. Here is an example
Note:
It does not work in the example as your browser will throw a security error, but it will work fine when your not running on stack-blitz or some plunker type site. You could try getting around this by using Chrome and running with the --allow-file-access-from-files flag. as detailed here

The code should give you an idea of how it works. I use this in our main application everywhere and I have no issues. The key is the ngOnDestroy method calls close on the modal when you navigate.