I use Leaflet for drawing a map and try to use Angular Material for displaying some modals but I encountered an issue.
The modal (ModalComponent
) should be opened when the user clicks on the map, for which I've added a click event (see the MapComponent
).
Inside this event, I am calling a method, this.modalService.openModal
, which will open the modal.
The issue is that the modal is opening empty. If I press ok/cancel, which should close the modal, this is rendered again but with proper data. The second time when I press on a button, the modal will be closed.
Strange behavior that I observed, is that the modal goes through the constructor but not through the ngOnInit method. Only after I click on a button it goes through ngOnInit.
Here you can find the sample code: https://stackblitz.com/edit/angular-ivy-ptqcvv?file=src%2Fapp%2Fmap%2Fmap.component.html
Here is my config:
- npm 6.13.4
- Angular CLI 8.3.29
- Angular 8.2.14
- Angular Material 8.2.3
- Google Chrome 84
Does someone have an idea of what is happening?