-2

I want to execute function in angular on a specific time interval and how can we stop that too. Please give me solution for that.

3

1 Answer 1

2

Your question seems to be about JavaScript in general, not specifically Angular. You could use setInterval and clearInterval to execute a function on a fixed interval:

// Will print each second let interval = setInterval(() => console.log("I am a text"), 1000) // Stops the interval clearInterval(interval) 

Documentation: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.