0

In AngularJS, is it possible to call a function repeatedly(say every 20 minutes)? I tried $timeout, but the function will be called only once.

Basically I want to pop up a notification dialog every 20 minutes of inactivity.

2 Answers 2

5

New version of AngularJS uses $interval for this. See http://docs.angularjs.org/api/ng.$interval

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

Comments

1

Just call $timeout again in the function. If this is not possible, write a wrapper function like this:

function wrapper() {
  theActualFunction();
  $timeout(wrapper, 12345);
}

$timeout(wrapper, 12345);

2 Comments

i got $timeout is not defined
$timeout is a service so you have to make sure it is injected properly.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.