maximelafarie / ngx-smart-modal

Modal/Dialog component crafted for Angular (Ivy-compatible)
https://maximelafarie.com/ngx-smart-modal/
MIT License
325 stars 85 forks source link

Issues with initializing semantic ui elements #197

Closed archigo closed 1 week ago

archigo commented 5 years ago

I'm submitting a ...
[X ] feature request

Current behavior When rendering a child component inside a modal, the elements are not rendered until the modal is opened. This means that calling the jquery initializer methods for semantic ui do not work in ngoninit etc. Instead you have to find an alternative way to call these after you are sure the modal has been shown the first time, such as :

this.ngxSmartModalService.getModal('xxxxx').open();   

if (this.isFirstModalShow) {
      this.isFirstMainShow = false;
      setTimeout(() => {
        this.childComponentInitSemanticUiElements();
      });
}

Note: The problem doesn't have anything specific to semantic ui, it's for anything where you want to access the dom elements from jquery.

Expected behavior Just like there are events that fire after the modal has been closed, it would be practical to have events like "onOpened" and "onFinishedRendering" where you know the DOM elements are available.

maximelafarie commented 5 years ago

Hi @archigo and sorry for the late answer. I understood your issue and yes, we have to implement more events for opening. Have you tried the existing one (onOpen)?

Cheers! 🖖

archigo commented 5 years ago

onOpen did not work for me unfortunately.

maximelafarie commented 4 years ago

Sorry for the late answer @archigo. Did you find an alternative since you opened this issue? I was guessing about playing with classes and opacity of the modal or its content to avoid a such glitch... 🤔