-
Notifications
You must be signed in to change notification settings - Fork 27.4k
perf(Scope): $postDigestWatch #5828
Comments
👍 Totally agree on this one. We had some issues integrating a custom carousel implementation due to conflicts w/ Hard to describe, but basically it was to allow for a generic parallax-like sub-directive that works based on the ratio of how "active" a particular slide is (we should be open sourcing it soon). The problem is the way |
@kseamon what about |
I just addressed this in my last comment. |
Aside from the privacy issue, $$postDigest registers a one-time callback for the current $digest cycle. In order to do what I'm talking about you would need to do something like this:
With $postDigestWatch, it would just be:
|
This is really a smart idea. I see what you mean now. |
+1 - just ran into a similar situation, and we use the $timeout workaround way too much. |
Though, for edification, how would this differ from $evalAsync? |
@DavidSouther $evalAsync forces a digest. |
Interestingly this is kind of what happens now for Perhaps we could think about abstracting this out of the |
Currently, directives that do nothing more than watch an expression and update the dom in response use $watch (for the most part).
This subjects them to repeated dirty checks every $digest cycle and might even trigger multiple dom updates.
Since they will never update the scope themselves, there should be another kind of $watch that will execute exactly once after the scope has stabilized in a $digest.
The text was updated successfully, but these errors were encountered: