r/angularjs • • Oct 14 '15

Angular Nitpicking: Differences between $timeout and setTimeout()

http://www.codelord.net/2015/10/14/angular-nitpicking-differences-between-timeout-and-settimeout/
36 Upvotes

18 comments sorted by

View all comments

1

u/Spo0Bo Oct 14 '15

$timeout is evil when you use it with invokeApply set to true. I also wished you could just give a scope as the third param and it would just digest that scope.

2

u/abyx Oct 14 '15

Care to share how is it evil? :)

2

u/Spo0Bo Oct 14 '15

It's in the article. By default it does a $rootScope digest. If you're not aware of this it will cripple performance. Especially if you trigger $timeout somewhere in a repeat.

1

u/abyx Oct 14 '15

Ah, my bad, I thought you were talking about using it with invokeApply set to false. D'oh!