I have a watch set up to track when a property in my service changes. When the property changes, i need to make an AJAX call to a webservice, however, when the property DOES change, the watch is firing twice. I have tried checking newValue !== oldValue but when I log their respective values to the console, the first time the watch fires it look like this:
newValue: MyObject, oldValue: undefined
and then when it fires immediately after, they are identical to the first time:
newValue: MyObject, oldValue: undefined
The problem this causes is that 2 AJAX calls get made instead of 1. How do I get the watch to fire the function once?