While profiling Angularjs app I can see that on a slow page digest runs 5 times and many expressions evaluated too many times and many expensive controller functions are called multiple times as well. Is there a way to prevent watched expression from being evaluated more than 1 time within a single digest?
Few examples to better illustrate the question:
- I have an icon picker with 300+ icons, each icon has
{background: colorPicker.color} - I have a very expensive function to check if page is modified and needs saving. It does a deep equals on initial version and current version of a very large object.
So I know that when digest is running I do not need to re-evaluate these. I would like to have a way to cache calculated values within a single digest cycle.
One time binding is not an option, these watched expressions do change, just not within single digest.