If I want to call a function in a controller when I make changes in a different controller, I usually use $on
and $broadcast
.
However, I've started using $watch
more recently. Now, I have a variable in a service, for example this.shouldIReload = false
. Whenever I make a certain change(for example, deleting an item in a modal), I change the value in the service, and using $watch
, I can call a reload function in another controller. This works.
Which way is better? What are the pros and cons of each?