What is ‘cheaper’ performance-wise $broadcast or $watch

$watch() is doing dirt-checking: the function makes a comparison each digest cycle. On the other hand, $broadcast() propagates an event only when there is one. Naturally, $broadcast() is cheaper than $watch().

But did you really have to worry about performance here? One primitive comparison by cycle is nothing. However, conceptually, $watch() is clearly what you need: you want to do an action each time a variable changes. I can’t imagine using $broadcast() here.

Leave a Comment