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
Auto Close Modal window if no activity more than several minutes
posted

Hi,

I have a use case to make modal window feature to be auto close if no activity more than minutes i.e. 1 minute : https://es.infragistics.com/products/ignite-ui-angular/angular/components/dialog

Does any good practice example how to implement it on Infragistics UI on angular ?

Thanks

HDi

  • 21795
    Offline posted

    Hi Achmad,

    One way to achieve auto closing of the dialog is to use setTimeOut. You can start the timer in opening event of the dialog like this:

        this.dialog.opening.subscribe(e => {
          setTimeout(e => {
            this.dialog.close();
          }, 1000);
    

    You can add this logic in your component's ngOnInit life cycle hook. Note, do not forget to clear the time out, nice place to do this is dialog's closing event, as well as remove all the subscriptions.

    Here is a small sample showing how you may achieve all this - IgxDialog Auto Close.

    Please let us know if any additional questions on this matter arise.

    Milko Venkov

    Software Developer