csvan
csvan

Reputation: 9454

AngularJS - run task in background repeatedly

I am relatively new to AngularJS.

A current usecase I am working on involves running a function every N seconds, as long as the user has the browser window open. This background service must not in itself interfere with the rest of the app.

What is the preferred way to do this in AngularJS?

Upvotes: 2

Views: 2172

Answers (1)

Henrik N
Henrik N

Reputation: 16274

Use $interval as mentioned by @dustyrockpyle.

Note that using a regular setInterval with AngularJS is usually not a good idea, as Angular won't automatically notice any changes made.

Upvotes: 5

Related Questions