Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to create an event that lasts for some time?

For example, I have a div:

<div [hidden]="!isNotificationDisplayed" class="notification">
  <h2 align="center" class="set-margin" #notification>Node was...!</h2>
  <h4 align="center">Press 'Space' to hide it</h4>
</div>

isNotificationDisplayed is a variable whose value (true/false) determines whether this div will be displayed or not.
By default, it is set to false, meaning the div is not displayed. I want to make a function that sets true for 3 seconds, i.e. the div is visible for 3 seconds, after which it is reset to false.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

setTimeout(() => {
    this.isNotificationDisplayed = true;
  }, 3000);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading