Can an inverse use of $watch in Angular be implemented?
The Issue
I am using angular-translate and I aim to execute a $http.put for every missing translation. However, I encounter the following error:
"10 $digest() iterations reached" when trying to $http.post() from ng-translate error handler
Possible Solution
To address this, I have initialized an array to hold all IDs of missing translations. Once the page is loaded, my plan is to send this array to the backend, where the IDs will be validated and stored in the database.
The Query
How can I determine when the page is fully loaded, or in other words, how do I ascertain when Angular is prepared to add the missing translations to the array? I am considering using an inverse $watch function that triggers when there are no elements in the array/collection for a specified duration, like 1 second. Is this feasible, or are there better approaches to tackle this issue?
I cannot provide any specific code examples as the functions utilized are basic such as $http and array.push.