Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
How to open IgxDialog from another component
posted

Im trying to create a common Dialog Component which can be open from any component.
I want to implement IgxDialog like mAtDialog is used with MatDialogRef where the component is passed and can be opened via a service.
I couldnt find the exact instruction to implement the same with IgxDialog.

Parents
  • 740
    Verified Answer
    Offline posted

    Hello Kaushik,

    Thank you for contacting Infragistics Community!

    In order to render dynamically a common component I suggest one of the following approaches:

    1. Declarative – using ngIf: You can refer to the following sample I have prepared for you. As you can observe I have created the two-way bindable property opened in order to control the state of the dialog through its parent components.
    2. ComponentFactoryResolver: here the most essential part is that the component should be attached to a specific place using a ViewContainerRef. As you can observe I have used the placeholder directive in order to get a reference to such ViewContainerRef within the following sample. As this would be a common component I suggest placing the directive within a component which would exists through the entire lifecycle of you app, for example the app component. The rest is handled within the dialog.service.ts.

    Please take your time to investigate both samples and let me know if you have any further questions.

    Best Regards,
    Martin Evtimov
    Associate Software Developer
    Infragistics, Inc.

Reply Children