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
15
Trigger snackbar programmatically
posted

I'm trying to find the best way of using the snackbar component programmatically. The examples only show it being triggered in the HTML via other HTML elements. I wish to trigger it from the TypeScript programmatically, in response to internal behaviours (show errors, etc). I can't find what is the best/recommended way of achieving this? There are a number of methods described for inter-component communication, so I'm unsure which is best/easiest to work with the Ignite components.

Thanks

Parents
No Data
Reply
  • 60
    Offline posted

    Hello Coran,

    Thank you for contacting Infragistics Support.

    I have been looking into your requirement and what I can suggest is using the property decorator. You can access message from the typescript code using ViewChild:

         @ViewChild("snackbar", { static: true })

          public snackbar: IgxSnackbarComponent;

    I have created a small sample in order to demonstrate suggested approach. For the purposes of the example, I added an input, where you can enter a message which you want to show.

    Please feel free to continue sending updates to this case at any time. 

    Regards, 

    Malin Hadzhiev

    Entry Level Software Developer

    Infragistics 

Children
No Data